Linux dd software raid

ddlinuxraid

Please advise what is the best way to create linux software raid image with dd?

/dev/md0 consists of /dev/sda & /dev/sdb.

  1. I ran dd if=/dev/sda of=sda.img same for sdb
  2. Restored on the remote system
  3. Restored MBR
  4. Now I'm getting some error that could be fixed with FSCK.

I wonder if there is a better way of doing it? on the running system though…

Thanks in advance

Best Answer

Why would you ever use dd in this situation? You should create the (I assume) RAID1 volume with the disk whose contents you want to keep and a missing component for the other drive, and then add the second drive in and let MD take care of the data copy. Note, though, that whether you use dd or not, you're going to have to leave some empty space at the end of the block device for MD to put it's metadata.