Harry's List Architect the future

How to deterministically mount persistent disks in Google Cloud

Adding additional disks to an instance in Google Cloud is straightforward. But, what if you want to mount these disks in a specific order? Or mount a particular additional disk to a specified folder? Using the generic /dev/nvme.. path relies on the order the disks were attached to the instance.

The solution to this race condition is by specifying a “device name” when attaching disks. Here is an example:

gcloud compute instances attach-disk ${INSTANCE} \
  --disk=${DISK} \
  --device-name=${DISK} \
  --project=${PROJECT} \

Following this example, you should expect to see your disk identified by it’s device name label in the directory /dev/disk/by-id, for example:

ls -l /dev/disk/by-id
google-persistent-disk-0 -> ../../sdb
google-mydevicename -> ../../sdc

Now partitioning and mounting can be performed deterministically:


parted /dev/disk/by-id/$disk_label -s -a minimal mklabel gpt mkpart $partition_label ext4 0% 100%
PART=$(blkid -o device --match-token "PARTLABEL=$partition_label")
if ! mount -t ext4 -o nodev,noexec,nosuid $PART $partition_path; then
  mkfs.ext4 "$PART"
  mount -t ext4 -o nodev,noexec,nosuid $PART $partition_path

What if this /dev/disk/by-id folder doesn’t exist?

Say you’re using a custom disk image, this /dev/disk/by-id folder most likely won’t exist. That is because Google has a custom script baked into their images that creates device paths based on device names. Here is the script for your own purposes: https://github.com/GoogleCloudPlatform/guest-configs/blob/master/src/lib/udev/rules.d/65-gce-disk-naming.rules

If all you need is to deterministically mount disks, here is relevant piece from that script:

nvme_json=$(nvme id-ns -b /dev/$nvme_device | xxd -p -seek 384 | xxd -p -r)
nvme_device_name="$(echo "$nvme_json" | grep device_name | sed -e 's/.*"device_name":[  \t]*"\([a-zA-Z0-9_-]\+\)".*/\1/')"

I'm Back!!

That’s right. I’m back

Why the sudden return?

  • realized i’ve been holding onto too much
  • sharing is caring
  • writing is fun
  • even more fun is looking back on old writings
  • organizing thoughts is a form of meditation
  • got to a point in career where i have some perspective
  • finally consider myself a senior engineer

In the land of Moose and Harry

In the land of Moose and Harry,
Two friends rode with hearts so merry

On their trusty Onewheels, they flew
A way of life they loved, so true

From sunrise to sunset, they’d roam
Exploring new paths and finding home

Their passion for riding knew no bounds
Moose with his girlfriend, Harry unbound

Together they journeyed through the land
With extra batteries, they took a stand

Riding nearly a hundred miles each day
Their Onewheels powering their way

Dreaming of routes yet to be explored
Their minds and hearts fully onboard

Their boards upgraded with chargers so fast
Quickly recharging, they’re ready to last

One day they’ll ride from coast to coast
Their love for adventure, never to boast

Moose with his girl, Harry the bachelor
Their passion for riding, forever a factor

In the land of Moose and Harry, they roam
A never-ending journey, they call home

Their love for Onewheels, a way of life
Forever exploring, no end in sight.

taing the scenic route

Weekends growing up, my parents took the family on road trips to Vermont. Lush summer hikes with trails and waterfalls. In the winter, we went snowboarding at Okemo mountain. First thing in the morning, we would go out and ride till the last lift. Life was simple back then, and snowboarding was my favorite activity.

Skip ahead 30 years later and I’m skateboarding my way around NYC. Spur of the moment, I ordered myself a onewheel for my birthday. Little did I know, my skateboards were about to start collecting dust. As soon as the onewheel arrived, that became my primary method of transportation.

Most limitations of skateboarding, including electric skateboarding, do not apply to onewheel. It can go offroad. It can ride in the rain. It’s a nice smooth ride. There’s a sense of freedom that can only be enjoyed in the moment.

It is something that looks so different, yet feels so natural. Taking flight with fancy footwork and rhythmic movements, my commute has transformed into an amusement ride with a dance floor. Life is about the journey, and riding gives me a chance to stop and smell the roses. It can be worthwhile taking the road less traveled, there are beautiful parks everywhere ready to explore.

As an idea spotlight, I want to encourage everyone to be happy and have fun. Give yourself time to do things that make you happy. If you don’t have time, make some, because you only live once and life is better with smiles. Pay attention to coincidences. Follow your dreams.

How I learned to Stop Worrying and Love the Password

Passwords are [adjective here]. Everyone has a good story about them.

Where do you keep yours? How many can you remember? These are just some questions that many people would be embarrassed to answer publicly. And they have good reason, for we are all a part of this password protected experiment and have gone through the same tribulations.

So, you’re telling me there’s a way to be confident about passwords?

Yes and no.

There’s something user friendly in the works, and if you are adept at the terminal then join the party! If you don’t know what the terminal is and are still scared, then take a chill pill and use pen and paper for your passwords. We’re about to hack the matrix over here. I’ll try to explain when necessary, please let me know if anything is unclear.

We are using PGP keys for authentication. What this means is, a public key to share with other people, and a private key that only I (or you) have access to. These keys are plain text and can be written down or emailed. Ideally, we are actively using a subkey of a master key that is securely locked away. For optimal security, the private subkey exists only a smartcard from which it cannot be extracted, solely read internally for authentication. For optimal privacy, the setup should be performed on an air-gapped machine with a free OS.

The software we use for our PGP keys is Gnu Privacy Guard (GPG), a free implementation of the Open PGP standard.

Enough about the keys, what about the passwords?

All in time. There is still some philosophy to be learned.

These keys vastly simplify access control management. With a collection of public keys, anyone can share secrets with one another, and only the intended recipient(s) will be able to read the message. Similarly, we can encrypt files for ourselves that only our private key can unlock.

So you could store all your passwords in a text file that only you can read. I’m sure many people do something like this (also unencrypted). But this sounds rather inefficient and clumsy. What I am proposing here is to use password-store (pass).

Pass is simply a wrapper around GPG and Git. A version controlled set of directories containing pgp encrypted files. Easy to keep in sync and share, and no worries about anyone using your passwords because only you have the private key!

Keep it secret, keep it safe!