1

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

RomanG
  • 11
  • 1
  • 2
  • Post this to superuser.com. And make sure the partitions are flagged for MD. mdadm should show them even if the fs is not online. –  Mar 08 '12 at 04:29
  • 2
    The best way is to back up /dev/md0, not the devices in the raid array. If the array is assembled then the drives could go into an inconsistent state if one is updated after you backed it up, but before you backed up the other. – phemmer Mar 08 '12 at 06:11

1 Answers1

2

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.

womble
  • 96,255
  • 29
  • 175
  • 230
  • I'd imagine any situation in which you want an image of a raid device. RAID 1 isn't going to cut it if you're taking an image for a court case. – Sirex Mar 08 '12 at 08:12
  • 1
    @Sirex: The question doesn't talk about creating an image of a RAID device, it asks "the best way to create linux software raid image with dd". – womble Mar 08 '12 at 13:09
  • so what's the best way? to create a live software raid image then ?Thanks – RomanG Mar 09 '12 at 02:16
  • I guess I don't understand. I read your "the best way to create linux software raid image with dd" as exactly what you say this question isn't about. odd. – Sirex Mar 09 '12 at 15:39