Linux Software RAID - Migrate from disk device to a partition

3

I have two 8TB disks configured as RAID1 using mdadm on Ubuntu 18.04 server. They way I created software RAID was on the whole device - /dev/sdb and /dev/sdc - instead of the partition such as /dev/sdb1 and /dev/sdc1.

The problem is, the RAID does not assemble on reboot and the only way to get back the md devices is by recreating - running the same command used to create the RAID1 volume initially. I've read here that for the md device to assemble automatically upon reboot one needs to create RAID on partitions instead of the whole device .

I have LVM on top of the RAID1 and use it as store for VMs managed using Ganeti. I already have few VMs running and using about 2TB of the total 7.6TB capacity.

If I create a partition on these disks spanning the whole device and create RAID again as I currently do, is there hope in getting back the LVM and the partitions on it?

Lungten

Posted 2018-12-31T10:33:11.893

Reputation: 31

I tried to test this out under VirtualBox using 10GB disks and it looks like this is not possible. After recreating RAID on the new partitions I do not get back the volume group. – Lungten – 2019-01-01T05:42:54.323

This is doable, but high risk. You need to back up first, then ensure the LVM has space free at the end, then shrink RAID (using --grow ! ) then finish a full rebuild RAID, remove first disk, partition, add back. – davidgo – 2019-01-01T06:58:39.943

I should have explicitly stated you need to shrink the PV under LVM. – davidgo – 2019-01-01T07:00:14.683

@davidgo Shrinking RAID and rebuilding makes sense. I will try this. – Lungten – 2019-01-01T09:17:03.440

No answers