I'm trying to programmatically mount a disk image created with the Fedora LiveUSB creator, and I'm encountering some issues.
From what I've been told, it's very difficult to mount LVM snapshots outside of the host system. I have both the "pristine" image and the persistent snapshot, so I thought that it should be technically possible.
Any ideas?
LVM's concept of volumes is not portable across systems in the same sense that you can slap some md drives together and they'll still work. Each LVM vg has a unique identifier and you need to get your system's LVM to accept it. In other words, LVM can't "see" the volume group until you "tell" it about its presence. Once you do that, it should be smooth sailing from there.
The snapshot consists of recorded sector deltas. You are correct, you should be able to get your snapshot to show up by having both the original and the snapshot present. A snapshot by itself will not work.
I'm assuming that you're looking at scripting this together, because you just need the lvm toolset to make this happen.
A little parting gift to help you on your way. Save it as /usr/sbin/lvms, set owner as root/root, chmod 755, and use it to save your fingertips.
#!/bin/sh
#lvms command - consolidates all LVM views into a single command
pvscan 1>/dev/null 2>/dev/null
vgscan 1>/dev/null 2>/dev/null
lvscan 1>/dev/null 2>/dev/null
echo "Available Physical Volumes - - - - - - -"
pvs
echo
echo "Active Volume Groups - - - - - - - - - -"
vgs
echo
echo "Active Logical Volumes - - - - - - - - -"
lvs