Copy or Mirror partition table from one drive to another

Use the following command to copy the partition table from sda to sdb.

sfdisk -d /dev/sda | sfdisk -f /dev/sdb

sfdisk -d dumps the partition table on to stdout. This is being piped to sfdisk /dev/sdb with the –force to write it on /dev/sdb.

You can use dd to copy the Master Boot Record (MBR) from one device to another (or to a file). For example, copying the MBR from sda to sdb would be done with

dd if=/dev/sda of=/dev/sdb bs=512 count=1
The flags are

if, input file (either device or ordinary file)
of, output file (either device or ordinary file)
bs, block size in bytes
count, number of blocks to copy.
The MBR contains the partition table for the four primary partitions, so this solution alone will not copy the definition for the extended partitions.

Reference: http://serverfault.com/questions/54797/mirroring-partition-table

Published by

Omshivaprakash

Gnu/Linux Enthusiast, Kannadiga, Wikipedian, Amateur photographer, trekker and more

Leave a Reply

Your email address will not be published. Required fields are marked *