Can't Mount LVM Snapshot Volume
Solution 1:
With the caveat that I don't know much about kvm, I would guess that the partition is a full disk image. If that is the case, you should get a meaningful partition table if you do:
fdisk -l /dev/guest_images_lvm/cvfunc_vol1
If this is the case, you need to do something like this article suggests: http://www.andremiller.net/content/mounting-hard-disk-image-including-partitions-using-linux
If it is indeed just a partition, fdisk complains like so:
Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel
Building a new DOS disklabel with disk identifier 0xe3a5124c.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.
EDIT: Using -l options as per Andre's suggestion, to reduce grief for future readers.
Solution 2:
What filesystem is contained in the logical volume? Find out using dd if=/dev/SOMETHING bs=1024 count=1 | file -
.
Does the logical volume contain an XFS filesystem? XFS filesystems have unique identifiers, and Linux will balk at mounting the "same" filesystem twice, unless you use mount -o nouuid
on the snapshot.
Solution 3:
That LVM partition has been used by the guest as disk. On that disk it created one or more partitions. What you want to do is extract these partition information and make it available to your host system.
The easiest way to do this is to losetup
the LVM:
losetup /dev/loop0 /dev/guest_images_lvm/cvfunc_vol1_ss
And tell your Linux kernel about these partitons:
partx -a /dev/loop0
To mount:
mount /dev/loop0 /mnt/vm
To cleanup again:
umount /mnt/vm
partx -d /dev/loop0p*
losetup -d /dev/loop0
Why is it that you cannot just add the partitions from the LVM and need to take the extra step via losetup
? Since you certainly can list the partitions on the LVM, and it will be the same:
% sudo losetup -a
/dev/loop0: [0005]:19633989 (/dev/mapper/vg0-mail01--root)
% sudo partx -s /dev/loop0 ; sudo partx -s /dev/vg0/mail01-root
NR START END SECTORS SIZE NAME UUID
1 2048 20969471 20967424 10G
NR START END SECTORS SIZE NAME UUID
1 2048 20969471 20967424 10G
The reason is that LVM is managed by the dm
, the device manager, and it sure won't have anyone tell it that it's wrong about the partition setup.