Ross S. W. Walker wrote:
If you have a disk with several partitions set up as members of a raid1 md devices, can you make a dd image of that disk to replace its matching drive with identical partitions or are there differences between the mirrored partitions?
you can 'dd' the MBR and then re-add the partitions to the raid for resyncing with 'mdadm'.
# dd if=/dev/sda of=/dev/sdb bs=512 count=1 # mdadm /dev/md0 --add /dev/sdb1 # mdadm /dev/md1 --add /dev/sdb2
If you want to really make sure you got everything you could dd the whole first track with:
# dd if=/dev/sda of=/dev/sdb bs=512 count=63
-Ross
Or sfdisk -d /dev/sdX | sfdisk /dev/sdY where x is source and y is the target. This will work across drives that have slight geometry differences.
What I was hoping to do was to take the grub setup, the partitioning info and the contents in one shot and have the disks pair automatically when booted. They didn't - but I think the other parts worked.
Now, is there a way to change the uuid on a running raid1 set? I'd prefer that if the split and re-paired disks ever find their way back to the same machine that they not sync again.
'mdadm' writes a listing of the devices in the array to the md superblock and orders them by number,major,minor. You cannot add another device to the array with the same tuple.
Isn't this updated at detect time so the device minor's should always be different?
If you dd the first sector of the drive though you will duplicate the partition table and grub boot loader to the other drive. Then md-device-mapper will take care of copying the data over.
I'm curious as to why 2 complete dd'd copies don't pair at boot. One comes up running and it does work to mdadm --add the partner partitions and after the resync they do automatically pair at boot.