Header Ads

Backing Up and Restoring Your Boot Sector

When GRUB runs, the boot sector part of your hard disk contains information about which OS you can boot. This sector sometimes gets corrupted due to a system crash or power loss and your computer won't boot. Luckily, with a few carefully chosen commands, you can back up and restore this important sector.
Back it up using this command:

foo@bar:~$ sudo dd if=/dev/hda of=MBR-backup bs=512 count=1

The dd command copies the sector from the first disk (/dev/hda-change this to your disk) and saves it as MBR-backup in the current directory.

Quick Tip

When referring to boot sectors you may see it prefixed as MBR-this is short for master boot record.
To restore the sector, run this command:

foo@bar:~$ sudo dd if=MBR-backup of=/dev/hda bs=512 count=1

When you boot your computer in rescue mode, you can use these command to manage your boot sector.

No comments

Terima kasih.