GRUB Lesson Learned

** WARNING** The following entry has a high level of geekness, even for Linux users.  Read at your own discretion! LOL

Ok, so I had a minor scare tonight when I thought I had trashed my computer completely.  See, the other day I upgraded to openSUSE 10.3 and recreated all my file systems in the hope that I wouldn’t have to always rebuild my /home directory after every upgrade.  Unfortunately, as it turns out, 4GB of user space is not enough for my use since I use a VM to load WindowsXP on top of my Linux Desktop.  Its a really handy thing to have available, but it requires around 10GB minimum if you want to do anything useful with your VM.

So I began trying to expand my /home partition to a more appropriate size.  Doesn’t sound to hard now does it?  I mean there are apps like Partition Magic and GParted available just to for doing such things.  So I boot into Vista and fire up Partition Magic. My version is unusable in Vista!  Go Figure.  So I boot into Linux and fire up GParted.  It tells me that any partitions I want to resize have to be unmounted.  Hmm, that makes life difficult since I can’t exactly unmount / to use GParted.  So I thought for a little while and came up with the idea of using a Live CD.  I went back over to openSUSE and downloaded their Live CD since the Ubuntu one I had lying around refused to boot for some reason.

After about an hour I rebooted using the LiveCD.  It booted just fine and a low res Gnome Desktop greeted me.  I opened up the terminal and found that GParted was not on the LiveCD.  Urgh, who doesn’t put a partitioning utility on an Installation capable CD?  Turns out openSUSE has their own partitioning utility in Yast.  So I was finally able to shrink the / partition by the needed amount.  Now another headache!  I couldn’t grow the old /home partition to fill the now empty space because the free space resided on the other side of my now smaller / from the /home and the openSUSE utility couldn’t move free space around on the drive.

It turns out neither can GParted; at least not easily.  So Now I am stuck with all the free space and a still too small /home partition.  What to do?  Well the free space is large enough on its own to be /home.  So I used GParted to copy the smalled partition into the free space and create a new /home.  I changed my fstab to reflect the new partition for /home and rebooted.  It works!  So far so good.

Now what to do with the 4GB old home?  I thought about a backup partition, but its really not big enough for that.  So After some thought I decided to move my /boot to its own partition and recover some useful space in /.  A /boot of 4GB is a bit large, but it will work for now. So first thing I so is copy all the files into /boot with the ubiquitous cp -a.  That way I save all the permissions and its copies recursively.  Then I edit fstab again to point to the new boot.  For safety’s sake, I move the old /boot to /boot2 for now.  I go into the GRUB menu.lst and look around.  Nothing sticks out (More on that later) so I close it and reboot.

As soon as I rebooted, my heart skipped a beat.  I had forgotten to create a new /boot directory for fstab to link to!  My Computer just dies on boot.  Crap! I stick it the Live CD and boot, praying for miracles.  I was able to boot and mount the old partition into the Live CD.  I made a new /boot directory for fstab and rebooted.  GRUB dies with error 15.  What the heck is an error 15!  GRUB is supposed to look into /boot and then boot the kernel.  That’s the advantage of GRUB!  No big MBR rewrites.  Then it hits me that GRUB is still looking into the old / partition for /boot.  So now I begin pulling my hair out as I edit the grub.conf and menu.lst files.  Basically I have to boot the Live CD again, mount the partition under the LiveCD and make the edits.  Not a quick process considering the Live CD boots slow as molasses and you can’t create directories on a read-only filesystem.  So after I make the edits, I reboot.

Finally, I get a GRUB screen and can boot to my laptop again!  the Vista partition still exists, and nothing seems worse for the wear except my nerves and GRUB’s pretty bootsplash.  I keep getting some error about /boot/message not existing.  After a few minutes, I realize that menu.lst had one more entry in it needing redirection.  I made the edit, groaned and rebooted.

So after all this, I am finally back to normal, all my new partitions are setup, and all is well until the next time I go to tinkering.  This is what happens to me when I am on leave and have no projects to keep me busy! LOL  This and I write extremely long-winded articles that no one but linux geeks will find interesting or even know what I am referring to.

Short URL: http://bit.ly/bm6O3n
Comments: 2 Comments

2 Responses to “GRUB Lesson Learned”

  1. gregory says:

    Sounds like you had some fun..

  2. DoubleTapper says:

    Have you thought about backing up the entire install on a separate partition using imaging software?

    It would save you a lot of time when you need to reinstall.