2 weekend “Non-Events” that made me love Linux even more.

31 05 2011

This morning at work a co-worker asked me how my weekend went and if I did anything interesting. My reply was a simple ‘Nothing much. Watched Science Fiction on TV and worked on computers.” It was rather non-eventful after all. “Oh yeah? What did you work on?” I had to think about this for a second. Most of what I did was so trivial that I didn’t remember right away. I read a few documents I had been meaning to do. Sorted and tagged the photos from the last vacation. Cleaned out my inbox of emails. Oh yeah! I also did two interesting projects.

Two things actually did happen to me over this past Memorial Day weekend. Two things that were such non-events that I almost didn’t remember I did them. Even after I remembered, it took a comparison between Linux and another OS before it hit me of just how big of a deal this actually was to me. Once the full realization of what I had done sunk in I knew right away that I love Linux and all the people who contribute to it just a little more then I had before.

Non-Event #1

I had a 64bit Debian Squeeze install. Nothing special on it, in fact it was a very stripped down install. This was primarily a “Repository Server” for me. It was my local mirror for Debian Lenny and Squeeze, Ubuntu 10.04, CentOS 5, and Scientific Linux 6. A big hard drive with a very little OS footprint. Well, it wasn’t on a battery backup because I didn’t care enough. We got hit with a brown out that blew the power supply. My bad luck comes in to play with the fact that the power supply is a special one that I don’t have a replacement for and to buy a replacement would cost as much as the computer originally cost me.

So what to do? Well I pulled the drive out, and plugged it into a less powerful spare box. Booted the box, and the only major change was that instead of my two network cards being eth0 and eth1, they were now eth2 and eth3. The rest of the system ran just fine. I made a few changes to the network card properties and as far the network/computer were concerned the box wasn’t any different. My scripts all continued to run, the other computers still used it for pulling updates, and every one went on doing their thing. A complete non-event.

What makes this special then?

Well it occurred to me that many years ago when I still had a Windows XP box and my motherboard died, I had tried to take my hard drive out and plug it into a new system. Not only did it not work, but it complained that I had invalidated my license key! I had to do a backup (with a Live Linux cd) followed by a re-install. A co-worker pointed out that when they tried doing it with Windows Vista, they got the logo with the scrolling bar and it would never boot any further. They too had to re-install. In fact, from everyone in my (albeit very limited) group no one could think of a time when they were able to do this successfully with Windows *without* using a 3rd party migration tool.

This is why it was a non-event to me that was so very special. My Linux swap had no licensing issues. There was no halted booting. There was no re-install of my OS and programs with near endless updates for the updates. There was no pain, no suffering, no gnashing of teeth, nor was there even a sign of a feint hint of a headache in the foreseeable future. That’s how easy it was. I just swapped the disk and had my server back up and running with nearly no downtime or incident!

I Love Linux.

Non-Event #2
My laptop runs an older version of Ubuntu (because I am too dang lazy to update…thats why). It has been behaving rather odd recently. I knew it was the hard drive because when things went really wrong I could hear it slam the arm against the drive and spin down just moments before the laptop would hang. I have been too lazy to upgrade, so that should tell you that I don’t care enough about this laptop to swap the hard drives. Well I fired up a program by clicking its GUI icon and nothing happened. Huh. Try it again. Nothing. Try it from the command line and it refused to run. The heck? So just for grins I tried to run it with gdb. Oh boy, was it not happy. Huh. It ran fine earlier this morning. A random thought made me check the md5sum of the file vs what it was supposed to be. It didn’t match. Great. So I ran badblocks and guess what? I had a BUNCH of them! Arg. I knew it was coming so I couldn’t blame anyone but myself.

I turned on MythTV and watched more Science Fiction shows while I pulled the 80GB drive out of my laptop. Using a laptop-2-USB adapter I plugged it into my main computer. I found a smaller 40GB laptop drive that was in great shape, and I plugged it into my main computer with another adapter. I inspected the bad drive and it seemed that all the problems were in the 10GB root partition. There were three partitions: root, a small swap, and the rest in the home partition. For some reason the big home partition didn’t register problems, yet.

Using dd with the “conv=noerror,sync” option (lots of bad sectors that dd had to replace with 0’s) I copied the root parition (10GB) to the 40GB drive. I created a small 2GB swap partition on the 40GB drive, and dumped the rest into /home. On the 80GB drive /home had most of the space but I was only using ~5GB. Therefore, I mounted the two /home partitions and rsynced the data with proper permissions (no errors were reported). I had to edit the /etc/fstab of the new drive to edit the UUID’s of the new swap and home partition but that was it. I slapped the new drive into the laptop and booted it up. No problems at all. However, I did still have bad sections of 0’s, remember? And these 0’s were in the midst of various programs which would cause plenty of problems. I ran debsums and sure enough several packages reported problems. I reinstalled those packages and re-ran debsums. All good!

In total with all the file transfers, it was only about 3 hours while my attention was mostly watching a Science Fiction show that was almost as un-memorable as the replacing of the drive. Now my laptop has a working hard drive in it and appears to be in great shape.

What makes this special then?

As I was discussing this with my co-workers we came up with several pitfalls had this been attempted under Windows.

First, Windows doesn’t have a separate partition capabilities for its ‘Documents and Settings’ aka /home information (at least none that we are aware of without using third party tools of which at least one of us has tried with little success). Therefore the separating of all the users files from system files would have been quite painful.

Second, while a dd of a windows drive would have worked it would have a) required a Linux box or live cd (but we may just not know of a Microsoft alternative though I am sure there are paid-for 3rd party tools) and b) would have required shrinking the NTFS partition to the smaller drive size before transferring. The shrinking of the file system *could* have resulted in _more_ corruption depending on how it was done.

Third, program installation and program file tracking in Windows is absolutely terrible. There is NO other way of saying that without resorting to foul and inappropriate language. Unfortunately that language is almost necessary to describe how terrible Windows is at tracking and installing programs. Microsoft just simply doesn’t have a good package manager (they don’t even have something that rates higher then terrible). Therefore, even after a partition transfer with bad sectors there would be no way to check all the files installed by various programs to determine which files/programs needed to be re-installed. A bit-by-bit copy would have been just as broken.

Fourth, as discussed earlier in Non-Event #1 transferring installs between computers can be a huge pain. Now in this case since all the hardware was the same except for the hard drive, hopefully one wouldn’t have problems. Still how many people have changed a few items in their computer and had to re-activate their Windows license? A quick Google search says A LOT! I am glad this threat doesn’t hang over me in the Linux world.

Since a bit-by-bit copy doesn’t seem to have very good chance of working in the Windows world (in this example), maybe a migration would work. However, we are not aware of a good Microsoft provided migration tool. You would have to install Windows to the new drive, then use a third party tool (which would probably cost even more money) to migrate your programs, files, and tools.

Since migration is iffy and going to cost more money, the only alternative that has any good chance of working without paying more money would be to do a complete re-install. A re-install that would take a LOT of time and effort with FAR too many updates of the updates of the updates. And that is just for Windows. After that you have to install all of your programs and transfer your files.

Regardless of how you manage to rebuild the Windows laptop, it is going to be painful. It is VERY doubtful it could have been done in the same time frame. Especially if one devotes time and attention to watching a movie (or should I say multiple movies with a Windows install). The only hope of doing it in that time frame is if you already have all the third party tools needed. Even if you could get it all copied, you still have ZERO ways of checking your programs to find out which ones got corrupted, much less a easy way of repairing those files. To put it bluntly, some one in this position is screwed.

I guarantee that *I* could not have done that much work and effort over something that should be so trivial and easy without going stabby-stabby on the laptop and/or the closest Windows developer I could find. Under Linux it was a non-event. It just worked. Nothing at all to get frustrated about.

Two non-events that took very little of my time. Two non-events that would have destroyed my weekend had I been a Windows user. My sincere thanks to all those who put their time and effort into Linux to make these non-events.

I Love Linux. It just works.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: