Sunday, September 23, 2007


Note :Do not try this at home without adult supervision

I have been using linux for the past 5 years and use it as my primary OS.. but once a while I have the "OOPS" moment. (No.. this does not mean that there is a problem with linux, just means that if it was any other OS I would have just done a boring clean install because there was nothing else I would be able to do).

I have got so used to larger disk space that when I installed Debian Etch on my "new" 900Mhz machine with 10 GB hard disk, I never put any forethought while partitioning the harddisk. I just went for the default 2G root partition and ~8 G /home partition. As expected, with my rampant abuse of the apt-get command, I pretty much filled the root partition. Now my 500G external disk was mounted on home folder and I did not need any space in there, so it made real sense to redistribute the space. Complication 1: The /root was on a primary hard disk partition and /home was an extended one so I could not use gparted and do any easy cut paste operation.

The right thing a sane person would have done was to cpio the whole disks, repartition and then cpio the stuff back and fix the tiny inconsistencies along the way..but no. I was crazed beyond imagination. I created two disk images with dd and tried to restore them after repartitioning. This wouldn't be a problem for the root partition as the size of the formatted drive was bigger than the disk image..not so with the /home partition. /home didn't have anything anyway, so I thought that even if the image got partially copied, I would be able to fix the number of blocks in the superblock. (Now you know the meaning of the phrase: Little knowledge is a dangerous thing). I had never used dd earlier and had no idea whether this would work.. but what the heck, its all about keeping the spirit of adventure alive.

So after copying the larger disk image onto the smaller /home partition. I ran mkefs2 -S to fix the superblocks and ran e2fsck -y to check the filesystem and fix the errors automatically. It cleaned out my /home directory.. by that I mean it deleted everything.(btw I also tried dls and foremost before performing the step.. these are industrial strength forensic tools.. courtesy of Debian repositories).

Finally I did a clean install but fell asleep half way while configuring it. After waking up I discovered that I had deleted the font files, X, gdm, and few other gnome packages while asleep. I couldn't figure out the packages I had deleted while asleep (may be I wanted to get rid of them at a sub-conscious level :) and no amount of apt-get seemed to startup gdm.. I gave up and did another clean install. Hopefully this should be the last install.. today. All the software mishaps predicted by Murphy's law have already happened.

This exercise made me realize how rusty my sysadmin skills have become since linux became all "user-friendly".. ah the good old rh6 days.

No comments:

Post a Comment