Backup a partition table

Backup a partition table to create the exact same layout later again.

First of all, create the given partition table with parted or fdisk or whatever tool you like.

Warning

Use this method only on MBR[^MBR] disks. Do not use this on GPT disks (or disks with other partition table formats)!

Once your partition table is set up dump the layout to a file of your choice.

# sfdisk -d /dev/sda > /root/disk-mbrbackup.sda.partition.table.txt

Create the same partition table later on the same disk (or a disk with the exact same geometry).

# sfdisk /dev/sda < /root/disk-mbrbackup.sda.partition.table.txt

That’s it. Don’t forget to format the partitions with the representive filesystems!

Leave a Comment