is it possible to simultaneously mount 2 LVM volumes that are exact copies of each other (same UUIDs)?

Solution 1:

If you want to mount the lv's from a clone disk, I found this useful method here http://www.linuxquestions.org/questions/linux-hardware-18/unable-to-change-uuid-of-cloned-drive-device-left-open-4175470893/

vgimportclone -n orignalvgname_clone   /dev/sdx [/dev/sdy....]

sdx,sdy.. are the cloned disks which make up the vg.

vgchange -ay orignalvgname_clone

After this you should able to mount the lvs off the cloned disk.

Solution 2:

The answer by trekkerboy / modonnell @ linuxquestions is most straightforward, use vgimportclone.

Note also that after you create the clone, you have to activate it with vgchange -a y newvgname, and you have to clean up oldvgname's device nodes with dmsetup remove /dev/oldvgname/*.

For reference, what follows is a more manual method, which apparently resembles a subset of what one can read in the source of vgimportclone.


You can do it if you're able to first temporarily deactivate management of the original copy, by adding a pattern matching the original into the devices filter in lvm.conf. For example, if you cloned /dev/sdx into /dev/sdy, you have to temporarily add /dev/sdx into the filter within the devices { ... } section.

The original devices will stay online, but LVM tools will ignore them. Mounted filesystems on them will remain mounted and operational, that's not tightly coupled with LVM management.

After the filter is in place, do a new vgscan, to make sure the duplicates and only them are now under LVM management. You can make sure you see the duplicate /dev/sdy devices via e.g. pvs.

Then do:

vgchange -a n originalvgname

This will deactivate the volume group called originalvgname, but because only the duplicate devices are visible, it will deactivate it on them (the original originalvgname is already invisible because of the filter above). This step is necessary so that you can then freely change attributes of the now-inactive volume group and its constituent physical volumes.

pvchange -u physicaldevice
vgchange -u originalvgname

This will give new UUIDs to the duplicates.

vgrename originalvgname newvgname

This will rename the duplicated volume group.

After that, you can remove the filter from lvm.conf and rescan again, and both sets of LVM devices will be visible, under different names and UUIDs.

Alternatively, if you're not actually interested in keeping the original VG name and PV/VG UUIDs, you can dispose of them, instead, cf. https://superuser.com/questions/256061/lvm-and-cloning-hds

Tags:

Uuid

Lvm