Linux – Getting an error when mounting LVM snapshot

linuxlvmxen

I have migrated a file based Xen guest to LVM using

dd bs=1M if=/dev/zero of=/dev/vg00/vm10
qemu-img convert ~/vm10.qcow2 -O raw /dev/vg00/vm10

and changed the Xen domain file for the VM to use the LV instead of the old file.

The VM boots up, and now on the Xen host would I like to make a snapshot of the running VM.

# lvcreate --size 10G --snapshot --name vm10-snapshot /dev/vg00/vm10 
  Logical volume "vm10-snapshot" created
# mount /dev/vg00/vm10-snapshot /mnt/snapshot/
mount: you must specify the filesystem type
# dmesg |tail
EXT3 FS on dm-3, internal journal
EXT3-fs: mounted filesystem with ordered data mode.
hfs: unable to find HFS+ superblock
VFS: Can't find ext3 filesystem on dev dm-4.
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
VFS: Can't find ext3 filesystem on dev dm-2.
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock
hfs: unable to find HFS+ superblock

For some reason it can't see it is an EXT3 filesystem. I have also tried to mount with -t ext3, but still didn't mount.

# lvdisplay 
  --- Logical volume ---
  LV Name                /dev/vg00/vm10
  VG Name                vg00
  LV UUID                I1y1vQ-Bac5-5jwW-melh-TY5h-l9NO-qaelKk
  LV Write Access        read/write
  LV snapshot status     source of
                         /dev/vg00/vm10-snapshot [active]
  LV Status              available
  # open                 2
  LV Size                8.00 GB
  Current LE             2048
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:2

  --- Logical volume ---
  LV Name                /dev/vg00/vm10-snapshot
  VG Name                vg00
  LV UUID                GWsOx3-TPpr-GW64-uiMz-u1YN-QU4h-l0Kala
  LV Write Access        read/write
  LV snapshot status     active destination for /dev/vg00/vm10
  LV Status              available
  # open                 0
  LV Size                8.00 GB
  Current LE             2048
  COW-table size         10.00 GB
  COW-table LE           2560
  Allocated to snapshot  0.00% 
  Snapshot chunk size    4.00 KB
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:4

#

What could the problem be?

Best Answer

Unless you have an odd setup (i.e., please post your Xen config) /dev/vg00/vm10 is a disk image, not a filesystem. That is, it has a partition table and filesystems within it. Try doing a fdisk -l /dev/vg00/vm10 to see if this is the case. To mount an filesystem within that image you need to use a loopback mount. See, e.g., http://wiki.edseek.com/guide:mount_loopback