To add a few megs of space to my LiveDrive USB project, I repartitioned the drive in gparted, created some new LVM parititions, and then reinstalled the disk data by unpacking a tar archive I previously created. One crucial step I left out was telling my bootloader where everything went. Originally, my /boot partition was stored as the first partition. Somehow, I managed to make it the second partition (after my LVM), and now GRUB was all confuzzled.
To fix it, I tried running the command grub-install /dev/sdf. It failed saying it didn’t know which BIOS device corresponds to that linux device. The reason behind that is because on my host computer’s /boot partition, there is a file called /boot/grub/devices.map. In it is a cached mapping of BIOS devices to linux devices. Probing for devices takes a good bit of time, so it makes sense to cache it. This map file is only used by the command line version of GRUB, which recreates it when it doesn’t exist anyways. Renaming it let me progress a step further.
Now that GRUB sees the relation that /dev/sdf is my second BIOS disk (hd1), I tried messing around with grub-install again. It worked without complaint, but it still couldn’t boot. GRUB spit out a series of ‘GRUB’s to the console on boot, indicating some kind of horrible failure. Turns out, GRUB still thought my /boot was the first partition.
To finally fix this, I ran setup (hd1) (hd1,1). grub-install uses grub’s install command internally, but it uses it rather blindly. It assumes that the drive you give it is the same place where GRUB’s images are (those ’stage2′, ’stage1_5′, etc files). The setup command takes two arguments, and the second one is optional. The first argument indicates where you want to install the bootloader. I specified (hd1) to indicate I wanted it install in the MBR for my USB drive. The second argument indicates to grub where it can find its images and the menu.lst file. Remembering that partitions are 0-numbered, I told it to use the second disk and the second partition.
A few lines scroll by explaining exactly what commands it is running, then it should complete without failure. Once it did, my LiveDrive was bootable again.