How to? Partition table backup and restore
First, the way I've done it up until now, and then a question.
--- The old way (still works if you only have primary partitions and don't use GPT): save: dd if=/dev/sda of=./mbr.bin bs=512 count=1 restore: dd if=./mbr.bin of=/dev/sda bs=512 count=1 (the above copies all of the MBR, not just the partition table, but that is normally OK) But the above will not recreate extended partitions, since extended partitions are just a chain of more partition tables spread across the disk. So we could use this instead: save: sfdisk -d /dev/sda > ./sda_partition_table.sfdisk restore: sfdisk --force /dev/sda <./sda_partition_table.sfdisk However, the above will not work with GPT partition tables, nor will it work with partitions larger than 2TB. Question: So what is the best CURRENT strategy for backing up both partition table types (GPT and MBR), and extended partition data, and large partitions? I don't currently use GPT or have large partitions, but I'm sure I will in the future, so I'd like to know how to properly backup and restore this partition info going forward. Thanks! |
Rod has a full suite of utilities - including sgdisk; see his web page.
|
Thanks. That looks like exactly what I need. I found the commands in the "gdisk" package for LinuxMint (my desktop distro), but the package was named "gptfdisk" on SystemRescueCD (my recovery distro).
|
With GPT disks there is already a backup of the table at the "end" of the disk; if the primary partition table is damaged a program like gdisk will offer to recover the table from this backup. This is one of the advantages of GPT vs. MBR.
|
I am more concerned about making sure I am set up, backup-wise, for a bare metal restore on a new disk, not so much for repairing an existing disk using GPT's backup partition table at the end. Backing up the actual data on the partitions, that is easy. I guess backing up the partition table is easy too, I just didn't know how to do it for GPT. I was mentally still stuck back in the MBR, dd, and sfdisk days. My plan, up until I just learned about these gdisk tools, would have been to manually recreate the partitions. I have not read through the man pages on gdisk yet, but I am assuming it can dump the partition info to a file and also recreate partitions based on input from a previous dump file, like sfdisk can.
|
Similar but different - you get a binary file as output, not text. But you can feed it back in via the "-l" parameter.
|
All times are GMT -5. The time now is 02:39 AM. |