How to backup and restore a partition table on Linux

How to backup and restore a partition table on Linux

To backup and restore a partition table on Linux, you can use the sfdisk command.

To backup the partition table, you can use the --dump option, like this:

refer‮al:ot ‬utturi.com
sfdisk --dump /dev/sda > partition-table-backup.txt

This will create a file called partition-table-backup.txt containing the partition table for the device /dev/sda. You can replace /dev/sda with the device you want to backup.

To restore the partition table, you can use the --load option, like this:

sfdisk --load /dev/sda < partition-table-backup.txt

This will restore the partition table from the file partition-table-backup.txt to the device /dev/sda.

It is important to note that using the sfdisk command to restore the partition table will overwrite the existing partition table on the device. Make sure to backup any important data on the device before restoring the partition table.

You can also use other tools, such as fdisk or parted, to backup and restore partition tables. Each tool has its own set of options and syntax, so be sure to consult the documentation for the specific tool you are using.

Created Time:2017-10-28 21:38:58  Author:lautturi