1

For redundancy purposes, my computer has two identical hard drives.

I installed Ubuntu 12.04 and Grub in /dev/sda.

I cloned /dev/sda to /dev/sdb (I used FOG)

When I change the primary hard drive in the BIOS I don't always get that hard drive to boot. It doesn't always start the Grub installed in this "primary hard drive".

I have read some information about the boot sequence

http://www.dedoimedo.com/computers/grub.html

http://www.golinuxhub.com/2014/03/step-by-step-linux-boot-process.html

http://www.thegeekstuff.com/2011/02/linux-boot-process/

but I'm still unable to consistently boot from the drive I want. My fstab uses the UUID.

After the clone, the partitions in sda and sdb have the same UUID. I changed the UUID of the partions in /dev/sdbx with

tune2fs -U random /dev/sdbx

And updated the /etc/fstab file in /dev/sdb1 to use the new UUIDs. I then updated grub with

sudo update-grub

And I installed it in both hard drives:

sudo install-grub /dev/sda
sudo install-grub /dev/sdb

When I boot again, it doesn't matter if I choose the first (sda) or the fourth (sdb) option in Grub, it always boots from sda.

The file /boot/grub/grub.cfg uses the UUID. could this be related to my problem?

  • You probably need to look at the UUID's and change them to something new for your cloned harddrive; grub will probably refer to the UUID and just use a 'first come first serve' principle. You can change the UUID's with a live-cd with gparted, after which you will have to change the /boot/grub/grub.cfg accordingly (which, in this case, is allowed IMO) – twicejr Nov 9 '16 at 10:32
  • The decision which drive is sda and which drive is sdb depends on the ports the drives are connected to. If you have four SATA-ports, the drive connected to the first port is sda. Numbering of ports is different on motherboards, may be port0-3 or port1-4. In the first case port0 is sda, in second case port1 is sda. – mook765 Nov 9 '16 at 11:56
1

To get the cloned drive to boot you need to reinstall Grub on this drive. Boot to sda and when the Grub-menu appears choose Ubuntu installed on 'sdb' to start. then open a terminal (Ctrl+Alt+T) and run the command

sudo grub-install /dev/sdb

This will reinstall Grub to the MBR of sdb and this Grub points to the partition where Ubuntu is installed on the same drive. The other drive sda will be untouched and will work like before.

Checking the UUID's of the partitions on sdb with

sudo blkid

as mentioned in the comment of twicejr is a good idea, probably you have to adapt the UUID's in /etc/fstab on sdb.

That's it, now you should be able to boot directly to sdb choosing this drive as first drive in the boot-order in BIOS.

Note: This is only valid if your Ubuntu is installed in legacy-mode ( good old BIOS-mode). In UEFI-mode it would be very different!

  • Thanks for your suggestion. I have updated the question with more details about how these steps didn't work for me. – Katu Nov 9 '16 at 14:30

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.