Saturday, February 23, 2019

How to transferring a pair of Mdadm Raid-1 hard drives from a machine to another machine

After removing the two drives from the first machine and installing them to the second machine, turn the machine on.  Debian will see them as /dev/md127.

Assuming you want to rename the md device to be `data`, you can do it by performing the following steps:
  • `sudo mdadm --stop /dev/md127`
  • `sudo mdadm --assemble /dev/md/data --name=data --update=name /dev/xdvi1 /dev/xdvj1`
  • `sudo mdadm --detail --scan`
  • You will get something like this, `ARRAY /dev/md127 metadata=1.2 name=tmp-mdadm:127 UUID=af8d2901:f37333e6:d8490a00:2855a00e`
  • If you want to name the md device as "data", you put `ARRAY /dev/md/data metadata=1.2 name=tmp-mdadm:data UUID=af8d2901:f37333e6:d8490a00:2855a00e` into the file `/etc/mdadm/mdadm.conf`.
  • `sudo reboot` 

Just to add to haimg's excellent answer. It may happen that even with a mdadm.conf, the system (at least for Ubuntu) may still auto-assemble the arrays prior to reading mdadm.conf. So when it finds it it just ignores the arrays that have just been assembled anyway.

To account for that, run sudo update-initramfs -u to regenerate the proper initrd.

References:

0 comments:

Post a Comment