Is there a way to move the grub to a new partition, or drive in linux in the grub rescue, or the live mode?
Asked
Active
Viewed 1.6k times
2 Answers
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
Sergiy Kolodyazhnyy
- 107,582
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:
update-grub- reboot, and select the partition you want to boot from (say /dev/sdb2).
- when booted, do
update-grubagain. this will make the current booted partition the primary boot partition. - 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!
vkersten
- 161