Wednesday, July 1, 2009

"Grub hard disk error"

short story:

- installed ubuntu server 8.04.2 LTS on machine using 160gb IDE drive (hda), including a single /boot partition and an LVM partition for root (/) and another LVM partition for swap.

- installed new 500gb Sata drive into machine

- created similar partition schema (partition 1 = 250mb /boot partition (sda1)), (partition 2 = logical of the rest of the space (sda2=extended info, sda5=data partition that was created inside the extended partition

- used dd to copy hda1 (250mb /boot) to sda1 (new 250mb /boot)

- made sda1 bootable using cfdisk

- added sda5 partition to main volume group using pvcreate

- used pvmove to tell LVM to move anything on the /dev/hda5 physical volume

- after ~4 hours (150gb @ 12mb/sec average, since its slow due to using atomic writes, etc), it was done moving all data off of the old 150gb physical volume

- used vgreduce to remove the hda5 physical volume from the main volume group (since nothing is on that partition now (well, technically its probably got all the data if you wanted to try recovery of some kind, I don't believe it writes 0's or anything to it during a pvmove))

- tryed using grub to re-install to new hard-drive (sda), all messages seemed to be fine

- shutdown machine and removed the 160gb IDE drive

- got "Grub hard disk error" ... with no other useful information, or ability to "enter" grub

- attempted to manually fix grub using rescue mode of ubuntu server install CD

- googled for a while

- didn't find anything that really helped me, but some useful information none-the-less

- then realized one of the options in the rescue menu was "reinstall grub" or something to that effect, I chose to re-install to (hd0) (thats hdZERO)

- I then chose to reboot the system

- Magic happened, and grub loaded correctly, and then promptly loaded Ubuntu Server for me, along with my VMWare instances that were set for autostart.

- Problem solved... why my manual grub flailing around didn't fix anything (tried many different things between grub-install, setup-grub, setup (hd0), etc, I have no idea why, but I'm happy that this route worked for me

No comments: