Pages

Monday, 28 November 2011

mbr, grub

mbr backup & restore
# backup bootsector
sudo dd if=/dev/sda of=bootsector.img bs=512 count=1

# restore bootsector - boot with a LiveCD and issue the following command:
sudo dd if=bootsector.img of=/dev/sda


# backup bootsector (to a usb stick)
sudo dd if=/dev/sda of=/media/disk/boot.mbr bs=512 count=1

# restore bootsector (boot with a LiveCD, insert the usb stick, and issue the following command):
sudo dd if=/media/disk/boot.mbr of=/dev/sda bs=512 count=1


grub restore
# boot with a LiveCD and issue the following commands:

sudo grub
find /boot/grub/stage1
# Use the output from this command in the next command.
# For instance, if the root partition is the second partition of the first harddisk:
root (hd0,1)
setup (hd0)
quit

No comments: