LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Help! Upgraded remote server from Squeeze to Wheezy, grub install fails (http://www.linuxquestions.org/questions/linux-software-2/help-upgraded-remote-server-from-squeeze-to-wheezy-grub-install-fails-4175442338/)

neilgunton 12-20-2012 01:37 PM

Help! Upgraded remote server from Squeeze to Wheezy, grub install fails
 
Hi all, I have a remote server hosted by Hetzner over in Germany (I am in US), so I don't have console access. It has software RAID1 over two 3TB SATA drives. It came with Debian Squeeze by default, and I have to upgrade it to Wheezy, so I just went through that process with apt-get. Everything went well until it came time to install grub. It gave me four choices on where to install, namely something like (from memory):

/dev/sda
/dev/sdb
/dev/md1
/dev/md2

It said if I didn't know which partition the machine was set to boot off, then it was probably safe to install on all of them, so I just checked all. It segfaulted and failed to install. So I unchecked the md entries, just so that the dist-upgrade could finish, and it succeeded... but I don't think that was right.

The apt-get dist-upgrade finished. Currently I am still running in the original kernel, not rebooted yet.

I know that with the big 3TB disks, it uses GPT rather than MBR - I became aware of this when Hetzner had to replace one of the RAID drives and I had to copy the partitions over to the new one, but I don't know what this means in terms of installing grub.

Apparently /boot is on /dev/md1, / is on /dev/md2 and /home is on /dev/md3.

I guess to summarize: Could anyone just lead me through the steps I need to do here in order to get a successful remote grub install on a GPT RAID1 system? When I finally come to reboot, I'd like the server to actually come up again...

Thanks very much,

Neil

neilgunton 12-20-2012 04:41 PM

Update: I eventually found this page:

http://www.howtoforge.com/how-to-set...n-ubuntu-10.04

It talks specifically about installing Grub2 on RAID1 - namely, it seems like it's ok to do the grub-install on each of /dev/sda and /dev/sdb.

Then, separately I found that for GPT, you need to have a small partition that is not used for anything else, but is simply marked as "bios_grub". Using parted, I was able to confirm that this already exists on my system:

Code:

kitten:~# parted
GNU Parted 2.3
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                               
Model: ATA ST33000650NS (scsi)
Disk /dev/sda: 3001GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start  End    Size    File system  Name  Flags
 5      1049kB  2097kB  1049kB                    bios_grub
 1      2097kB  34.4GB  34.4GB                    raid
 2      34.4GB  34.9GB  537MB                      raid
 3      34.9GB  1134GB  1100GB                    raid
 4      1134GB  3001GB  1866GB                    raid

(parted)

So that was the other piece of the puzzle, which was already there so I didn't need to set bios_grub explicitly. One thing to be careful of here, apparently, is not to set bios_grub on your boot partition - it has to be a small, unused partition (can be anywhere, doesn't have to be at the beginning). The funny thing is that just today there was an update for grub2 which gave me an error on my other (main) server, which has Adaptec RAID. I just installed Wheezy on this machine. I didn't have any spare space (I had taken it all up with /boot, swap and root). So I had to create this bios_grub partition, what to do? Well, I did the following:

1. Use swapoff to disable swap partition, and comment it out of /etc/fstab
2. Use parted to delete the swap partition
3. Create a new small partition (I gave it 100MB)
4. Use parted to set bios_grub to "on" on the new partition (e.g. if the new partition number is 4, then you would put 'set 4 bios_grub on' in parted command line - make sure you have the partition number right!)
5. Create new swap partition with remaining space
6. mkswap on new swap partition
7. Add uuid of new swap partition back to /etc/fstab

Then I was able to do grub-install without error. Phew!

I got the info on how to use parted to enable bios_grub from here:

http://velenux.wordpress.com/2012/07...pt-partitions/

I don't know why this has to be so complicated, lots of people use RAID and GPT is common now with larger drives. I really had to hunt around to find this stuff. I'm just noting it down here in case it might be useful to anyone else (and also as a note to my future self).

Neil


All times are GMT -5. The time now is 11:45 AM.