Backup and restore the disk table on linux

How do I back-up Linux partition with sfdisk command?

To backup /dev/sda partition table, enter:

 
# sfdisk -d /dev/sda > sda.partition.table.12-30-2015.txt

Copysda.partition.table.12-30-2015.txtto NFS mounted share or a USB pen drive.

How do I restore the Linux partition with sfdisk command to the disk?

# sfdisk /dev/sda < sda.partition.table.12-30-2015.txt
# sfdisk /dev/sda < /path/to/usb/pen/sda.partition.table.12-30-2015.txt

OR

 
# sfdisk -f /dev/sda < /media/usb/sda.partition.table.12-30-2015.txt

How do I replicate a disk partition table from /dev/sda to /dev/sdd with the same geometry?

This is useful for Linux based software RAID device. Say you replaced /dev/sdd and you want to rebuild the Linux software RAID array. The first step is to replicate a partition table from a disk to another disk:

# sfdisk -d /dev/sda | sfdisk -f /dev/sdd



你可能感兴趣的:(Backup and restore the disk table on linux)