The Brilliance of Linux

Every now and then, Linux does something that positively delights me.

I’ve been a Linux user for many, many years. Going all the way back to Red Hat 5.2, which I picked up to install on an ancient Packard Bell 486 in the late 90s. Since then there’s always been at least one Linux machine in my dorm, apartment or house somewhere. At various times I’ve even run it for my desktop OS, although these days I use macOS for that.

For much of that time, Linux was the choice of hackers, but was definitely not a choice for everyday users and required a significant amount of technical knowledge to run. That’s not true so much anymore, but growing in that environment I learned a lot about how computers and operating systems work.

But every now and then, Linux does something that positively delights me.

I have a large fileserver in my closet that runs Plex digital media library among other things. This machine has an SSD for it’s primary drive, and a 5-disk Linux software RAID array. Because I am a part hoarder, while cleaning out my parts closet one day, I realized I had all the parts to build a near duplicate of this machine.

So I assembled the backup machine. On this ancient Athlon motherboard, the SATA ports weren’t labeled, so I just plugged the drives in what I thought was the right order, with /dev/sda being the OS drive, and /dev/sd(b-f) being the RAID drives. When installing Linux on it (Ubuntu 16.04), it detected them in a seemingly random order, so the OS drive was /dev/sdf and the rest of the drives were the array. Guess I got them reversed. Meh, whatever, I’ll just configure it that way.

So I took it to work to allow it to be an offsite backup in case tornadoes destroy my house. I set up rsync to replicate nightly between the two, and everything was good!

… except that ancient motherboard had some issues. Anytime it lost power for more than a few minutes, it would throw CMOS Checksum Errors on the BIOS. I figured this was a bad CMOS battery, so I replaced the battery, but no dice. And because this board is 10 years old, good luck getting support on it.

So over Black Friday, I scored a good deal on a new motherboard. Added in some memory and a power supply that doesn’t sound like a jet engine (how did I deal with this in 2006?) I had a totally new machine. I intended to just use the existing hard drives with the new machine.

So I took the old motherboard and power supply out, leaving just the drives, and installed the new one. On the newer motherboard, the SATA ports were actually marked, so I installed the SSD on port 0, then the drives in top-top-bottom order in the remaining ports.

I was fully prepared to reinstall, but I decided, what the heck, let’s boot this thing up and see what happens. So I turned it on.

And it booted Linux. With almost no problems. All the way to the login screen. And when I logged in, even the RAID array was there, in a clean state, completely ready. Literally the only thing that didn’t work was the network card, and once I ran dpkg-reconfigure on the linux-image and fixed the /etc/network/interfaces even the network card came up.

Mind = blown. I literally rebuilt this entire machine, and it came back up like nothing happened.

The disks coming up was the coolest part of all. What was /dev/sdf on the old machine was now /dev/sda, but both the system and the RAID array were aware of this change. And, after a bit of research, the reason I concluded was because both don’t use node numbers anymore, but UUIDs or another type of ID. A quick glace at /etc/fstab will show something like this:

# / was on /dev/sdf3 during installation
UUID=baa30826-d0dd-49e0-b3eb-21751accc1bf /               ext4    errors=remount-ro 0       1
# /boot was on /dev/sdf1 during installation
UUID=078a7b64-0b84-4747-a07f-7bb74470385d /boot           ext4    defaults        0       2
# /mnt/storage was on /dev/md0 during installation
UUID=a988ff4c-1489-44d2-ac4d-bd24cdc70829 /mnt/storage    ext4    defaults        0       2
# swap was on /dev/sdf2 during installation
UUID=e22b8588-b9fb-422f-a479-d79e3ae50cba none            swap    sw              0       0

And some research seems to show that Linux mdraid uses metadata and not node numbers to assemble the array, so you can reassemble it in any order. Brilliant.

Comments (0)

Interested in why you can't leave comments on my blog? Read the article about why comments are uniquely terrible and need to die. If you are still interested in commenting on this article, feel free to reach out to me directly and/or share it on social media.

Contact Me
Share It
Randomness
Unlike Steve Jobs, unless you’re in the tech industry, there’s a pretty fair chance you’ve never heard of Dennis Ritchie.
Read More
Linux
The recent announcement by Linus Torvalds that the next release of Linux will be 3.0 has provoked rather furious discussion around the Internets about whether or not the incrementing of the version number is warranted. Linus himself has said that “absolutely nothing” has changed. “It will get released close enough to the 20-year mark, which is excuse enough for me, although honestly, the real reason is just that I can no longer comfortably count as high as 40.” This got me to thinking about the nature of version numbers. Once upon a time (when versions were driven more by engineers and convention, and less by marketing), a version number meant something. Major, minor, revision. A major new release that modified significant portions of the code from the previous release incremented a major version number. Version numbers less than 0 were beta releases. Linux has been at 2.x since 1996, and at 2.6.x since 2003. Mac OS has been at 10.x since 2001 (even though the current version of OS X is significantly different from the original release in 2001). Meanwhile, Google Chrome has blasted through major 11 “versions” in three years. Mozilla is planning to release versions 5, 6, and 7 of Firefox this year. You can’t tell me that they are going to change major parts of Firefox three times this year. In this case, version numbers are purely being driven by marketing. They need to “catch up” to Chrome and Internet Explorer. But we live in a different world now. One where, arguably, version numbers are becoming less and less important. The growth of “app stores,” I think, is desensitizing your average user to a version number. While apps in the app store still have versions, I couldn’t tell you what “version” any of the apps on my iPhone are (other than the OS), and I bet you can’t either. Any of the apps I’ve installed from the Mac App Store I could not tell you the version of them. I just know that, when I see the number on the icon, I know I need to do updates. The updates happen, and I get a new version with whatever new features are there (or, in the case of the Twitter app, whatever features have been removed). Then there are web apps which are versionless. What version of Gmail do you use? You don’t. You use Gmail. Sure, there’s probably a revision number or something in the background, but the user has no clue what version they’re using. And they don’t need to, because there’s no action they need to take. So version are numbered in a wide variety of ways depending on the product and overall seem to be becoming less important as the growth of broadband, “app stores,” web apps, and automatic updates make thinking about version numbers less important. So why does it matter if Linus ups Linux to 3.0? Ultimately, it’s just a number.
Read More
Linux
Here’s a quick article about how to make a multiboot USB stick under macOS. These are useful in a lot of situations - such as for doing system installs or system rescues - because you can boot a wide variety of live OSs from a single stick. There are a lot of guides out there for doing this on Linux, and a lot of software for automating it on Windows, but not a lot of guides for doing it on macOS. Fortunately, it is pretty straightforward as the instructions will be broadly similar to doing it on Linux.
Read More