Bootsector


title: “Bootsector”
date: 2016-01-18T14:32:29
slug: bootsector


Understanding MBR size

The mbr size is as follows in bytes:

Where,446 + 64 + 2 = 512

446 bytes - Bootstrap.
64 bytes - Partition table.
2 bytes - Signature.
MBR anzeigen

Hier als Beispiel /dev/sda

hexdump -s0 -n512 -C /dev/sda
Partitions-Bootsektor anzeigen
hexdump -s0 -n512 -C /dev/sda1
Command to delete mbr including all partitions
dd if=/dev/zero of=/dev/sda bs=512 count=1
Command to delete mbr only
dd if=/dev/zero of=/dev/sda bs=446 count=1

Backup MBR with dd command

dd the old good command which now backup partition tables even writes CDs ;). Backing up partition is nothing but actually backing up MBR (master boot record). The command is as follows for backing up MBR stored on

dd if=/dev/sda of=/tmp/sda-mbr.bin bs=512 count=1

Replace X with actual device name such as /dev/sda.

Now to restore partition table to disk, all you need to do is use dd command:

# dd if= sda-mbr.bin of=/dev/sda bs=1 count=64 skip=446 seek=446
Print Friendly, PDF & Email