Using LVM to move between drives


Finally got a pair of 500GB drives to do RAID1. So I needed to move from my single 300GB to a RAID1’ed 500GB pair.

For the dom0, I had to do a reinstall of Fedora. Since I would be booting off the drives, and I needed grub setup as RAID aware, it was just easier to reinstall + compile the kernel for dom0.

For the domUs, it was fairly simple where I had created a separate volume group for their logical volumes. First, create a volume group on the new hard drive (in this case, /dev/md126 since I was now using RAID) with vgcreate -s 32 domUs /dev/md126. (-s 32 means the extent size is 32MB. This must be the same as the extent size of volume group of your existing logical volumes are in, otherwise the volume group merge will fail!)

Then, merge the existing domU group with the new domUs group: vgmerge domU domUs (Put the volume group you want to merge into as the first option.)

Next, move the logical volumes onto the other drive: pvmove -v /dev/sda3 /dev/md126 This can be done online without bringing your VMs down, amazingly enough.

Then, once the move is finished, it’s time to remove the old drive. Do vgsplit -v domU domUs /dev/sda3 to isolate the old drive in its own volume group.

Then, do vgremove domUs to remove the volume group.

Finally, run pvremove /dev/sda3 to destroy the LVM label on the drive.

Technically the last two steps aren’t needed, but I wanted to keep the drive in while the VMs settle down, since a known-working install of Fedora exists on the other volume group on the drive.

  1. No comments yet.
(will not be published)