Monday, 27 February 2012

How to Take backup of MBR

Follow the steps to taking backup of MBR

# sfdisk -d /dev/sda > sda.out

 # cat sda.out
    # partition table of /dev/sda
unit: sectors

/dev/sda1 : start=       63, size=480134592, Id=83, bootable
/dev/sda2 : start=480134655, size=  8257410, Id=82
/dev/sda3 : start=        0, size=        0, Id= 0
/dev/sda4 : start=        0, size=        0, Id= 0

 To restore it

# sfdisk /dev/sda < sda.out

Or you can take the backup and restore grub using dd command.

Backup
# dd if=/dev/sda of=grub.bkp bs=512 count=1

Restore
# dd if=grub.bkp of=/dev/sda bs=512 count=1




 

No comments:

Post a Comment