0

I'm running Ubuntu 10.04, and planning to upgrade. Before I do, though, I want to make sure my backup/restore processes work. My backups, of course, have been running since I first installed 10.04, but it's only a restore that can demonstrate that they have been running successfully.

And I've found a problem. I don't know how to get grub2 configured correctly, on the restored disk.

Currently, my running system is on /dev/sda, with /boot on /dev/sda1 and / on /dev/mapper/desktop-root. (I'm using logical volumes.) This configuration has been running successfully for several years.

My restore is on /dev/sdb, with /boot on /dev/sdb1 and / on /dev/mapper/desktop2-root.

All of the files have been restored, and /etc/fstab has been edited, on the restored drive, to reflect the changed logical volume name and the new UUID for /boot.

But I only have grub installed on /dev/sda, so /dev/sdb is not bootable.

I'm not looking to do anything fancy. I'm not trying to dual boot, I just want to be able to boot from /dev/sdb, using /dev/sdb1 as /boot, and /dev/mapper/desktop2-root as /. In other words, I want to do to /dev/sdb exactly what running update-grub would do to /dev/sda, when I was booted off of /dev/sda.

Any ideas?

2 Answers 2

1
  1. Edit your /etc/grub.conf (or /boot/grub/menu.lst) on the /dev/sdb partition to reflect the necessary changes (sda replaced with sdb)
  2. Run chroot MOUNT_POINT_OF_/DEV/SDB
  3. Run grub-install /dev/sdb
  4. Test if you can that the setup is working as expected

If you have issues with the boot, you can boot the system manually by using the grub shell at boot.

EDIT: I assume that the disks are not part of a RAID array

3
  • This sounded promising, but grub-install errors out: "/usr/sbin/grub-probe: error: cannot find a device for /boot/grub (is /dev mounted?)." Running "grub-probe /dev/sdb" errors out as well: "grub-probe: error: cannot stat `/dev/sdb'." The problem seems to be that the devices in /dev, in the chroot'ed environment, aren't really connected to anything.
    – jdege
    Oct 18, 2011 at 1:38
  • I discovered that there are instructions on the Ubuntu forums that show what you need to do to do a chroot fix: basically, you need to do a "ount -b" on /dev, /dev/pts, /proc, and /sys, before you do the chroot. I haven't tried it yet... ubuntuforums.org/showthread.php?t=1581099
    – jdege
    Oct 18, 2011 at 13:10
  • Before the chroot run mount -t proc none MOUNT_POINT_OF_SDB/proc and mount --bind /dev MOUNT_POINT_OF_SDB/dev
    – ciupinet
    Oct 22, 2011 at 17:09
0

You want to reconfigure the grub-pc package:

dpkg-reconfigure grub-pc

One of the questions it will prompt you for is which disks you want to have grub installed on.

1
  • If I run that, while booted off of /dev/sda, will it not create a configuration that points to /dev/sda?
    – jdege
    Oct 17, 2011 at 2:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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