0

I have a lvm partition on a disk, and another, identical drive with no data on it.

Would it be possible to set up these two drives in RAID 1 using mdadm, with the same lvm data on top?

Perhaps by creating a RAID array that's missing a drive, copying all of the data from the partition over to it, and then formatting the partition, and adding it to the array?

0

Yes, you can do it this way. For example (when you have sda with parition sda2 which is PV in VG space:

  1. create new raid with missing device and add it to vg

    mdadm --create /dev/md1 --level raid1 --raid-devices=2 /dev/sdb2 missing pcreate /dev/md1 vgextend space /dev/md1

  2. move existing volume to md1:

    pvmove -v /dev/sda2 /dev/md1

  3. when it finish, reduce VG and add sda2 to array:

    vgreduce space /dev/sda2 mdadm -a /dev/md1 /dev/sda2

remember to add array to mdadm.conf (mdadm -E --scan >>/etc/mdadm/mdadm.conf) and add it to initrd when it's needed (for example when root is on lvm)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.