Do you have a removable hard disk with dual-boot systems and Grub2
boot loader? This is a simple tutorial about how to restore/reinstall
grub2 on a removable hard disk using a Ubuntu machine.
Commonly, to restore Grub2 is just this three commands to reinstall it on that device.
sudo apt-get install grub-pc grub-common # commonly installed already. sudo grub-install --root-directory=/ /dev/sda # install grub onto device /dev/sda. sudo update-grub # create grub.cfg config file.
Now, we’re going to restore grub2 on a portable hard drive using a
Ubuntu machine. First plug in this device, assume that it is “/dev/sdb”
(use
sudo fdisk -l
to check it) and mounted on “/mnt” (sudo mount /dev/sdbX /mnt
). Just use previous three commands with the second one changed to:sudo grub-install --root-directory=/mnt/ /dev/sdb
Now, everything’s done but “sudo update-grub” which will create
“grub.cfg” config file on Ubuntu local drive rather than the portable
hard drive, and the boot entries are the system entries on local drive.
Note: before following, make a backup first!
1.) To make “grub.cfg” created onto portable hard drive, edit “/usr/sbin/grub-mkconfig”
change:
sysconfdir=/etc
into:
sysconfdir=/mnt/etc
And run this to create a “grub.cfg” that will finally be moved into portable drive (under /mnt/boot/grub/)
sudo grub-mkconfig -o /PATH/grub.cfg
2.) For the boot entries, just edit the section in “grub.cfg”. Following may help. About add/remove grub2 entries, refers to http://ubuntuforums.org/showthread.php?t=1195275
ls -l /dev/disk/by-uuid # look up uuid of all device ls -l /mnt/boot # look for useful kernels
No comments:
Post a Comment