1

The first 512 bytes of MBR disk contains boot code and partition table, backing up (dd command) this area is useful.

I have switched to GPT right now, and want make a backup, is it in the same way to MBR backup?

2

No, the first 512 bytes of a GPT disk are actually reserved for an MBR partition table called the Protective Partition Table. This table is optional, but the space is reserved for this. The next 512 bytes contain the GPT header, but that doesn't contain the partition table, which comes next. The partition table on a GPT disk is much larger than MBR table.

The sgdisk program includes a way to make a backup of the GPT partition table, which you use like this: sgdisk --backup <filename> <device>, where <filename> is the name of the file where the backup is stored, and <device> is the device name if the disk.

  • so how many bytes is GPT header, ? – massix May 25 at 5:54
  • The GPT header starts at Linear Block Address (LBA) 1, right after the Protective MBR, which occupies LBA 0. The size of the GPT Header is one block, which is 512 bytes, or 4096 bytes, if the disk uses a 4k logical block size. The header does not include the partition entries, which typically start at LBA 2. Each partition entry is 128 bytes in size. The number of entries is specified in the header, as is the starting address of the entry table, but usually the table starts right after the header. See the Wikipedia GUID Partition Table article for more information. – Johan Myréen May 25 at 8:52
  • Please note that a backup of the GPT Header and partition table is not as important as the backup of an MBR partition table. The GPT partitions can easily be recreated, and there is no boot code or at the start of a GPT disk. The sgdisk manual page recommends against restoring a backup on anything but the original disk, because a new disk may be slightly smaller than the original, which can cause trouble. – Johan Myréen May 25 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.