4

Is there a way to move the grub to a new partition, or drive in linux in the grub rescue, or the live mode?

1
  • 1
    Not sure what you mean. The grub installed to a MBR for BIOS boot uses many files inside the LInux install. Or if UEFI the grub in the ESP uses those same files in the Linux install. If UEFI you can move the /EFI/ubuntu folder to another drive. If in Ubuntu and BIOS you can easily install grub to the MBR of another drive. What is it that you want in detail?
    – oldfred
    Aug 5, 2015 at 4:35

2 Answers 2

7

Yes, this can be done. The command is grub-install and its syntax is like so:

grub-install [OPTION...] [OPTION] [INSTALL_DEVICE]

Since you asked for a live media recovery, here's a procedure from this tutorial:

Boot the Ubuntu Live CD.

Press Ctrl-Alt-F1

sudo mount /dev/sda1 /mnt

sudo mount --bind /dev /mnt/dev

sudo mount --bind /proc /mnt/proc

sudo mount --bind /sys /mnt/sys

sudo chroot /mnt

Now the fun stuff. Lets say I want grub to be on /dev/sda2, I'd run sudo grub-install /dev/sda2 or alternatively sudo grub-install /dev/sda to be partition/OS independent

1
  • As you're a reputation 10 user: If this answer helped you, don't forget to click the grey at the left of this text, which means Yes, this answer is valid! ;-)
    – Fabby
    Aug 9, 2015 at 20:00
0

My answer to move the default boot to another disk, which is hard to find on the web:

Assume you boot from /dev/sda2 and you want to boot by default from /dev/sdb2. This without bothering/counting menuentries in /boot/grub.cfg, then:

  1. update-grub
  2. reboot, and select the partition you want to boot from (say /dev/sdb2).
  3. when booted, do update-grub again. this will make the current booted partition the primary boot partition.
  4. for added luck, do

a) install-grub /dev/sda

b) install-grub /dev/sdb

Now , if you ever pull drive /dev/sda , some bootable grub remains.

Happy booting!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .