Downside of copying partition table using dd for use in RAID array

0

I used dd to copy the (GPT) partition table from one disk to another, then added this disk to a mdadm RAID array, and the system seems to run fine.

Should I expect any problem, and is there any downside of doing that?

P.S: I used dd since I was stuck in the initramfs shell.

pim

Posted 2018-04-19T08:06:40.417

Reputation: 662

@KamilMaciorowski, thank you for the comment, fixed in the question, I talked about partition table! – pim – 2018-04-19T11:06:58.043

Answers

1

There is no problem with doing this - the source device will be presented as a single block device, as will the RAID array.

The only thing to watch out for is the duplicate that GPT stores at the end of the disk... if your new storage is larger, then this will appear too early on the device, and may prevent you from using the full capacity, depending on the tools you use.

Tools like gdisk will offer to relocate it for you when you write the partition table. See below:

$ gdisk ${DISK}
GPT fdisk (gdisk) version 1.0.1

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): w
Warning! Secondary header is placed too early on the disk! Do you want to
correct this problem? (Y/N):

I'd advise that you copy the GPT over, and run gdisk simply to re-write (and possibly re-locate) the partition table. After this, you can invoke gdisk again to handle reshaping your storage - if you need to.


fdisk will also take care of this for you:

$ fdisk ${DISK}

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

GPT PMBR size mismatch (204799 != 409599) will be corrected by w(rite).
GPT PMBR size mismatch (204799 != 409599) will be corrected by w(rite).

Command (m for help):

Attie

Posted 2018-04-19T08:06:40.417

Reputation: 14 841

2

No, that's a fairly common way of doing it - I tend to use SFDISK to dump and restore partitions but I have used DD in the past.

davidgo

Posted 2018-04-19T08:06:40.417

Reputation: 49 152