您的位置:首页 > 运维架构 > Linux

Backup and restore the disk table on linux

2016-01-06 17:17 465 查看

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: