Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'd like to backup my XEN VMs by copying-rsyncing a LVM snapshot. I'm trying to mount a snapshot that contains a XEN guest's virtual disk (ext4).

Below are all the steps I follow. I can't mount the snapshot and it seems there's no partition table in it.

The only existing volume group is "VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a"

The virtual disk I try to backup is: "/dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-8c8064d2-0101-46d4-b1e5-607ad4a92621"

The name of my snapshot LV is "vmbackup".

The man page of the mount command on the Xen Host doesn't show ext4 as supported. Therefore, I did the same test with an ext3 disk but it gave me the same result.

[root@ ~]# vgdisplay

  --- Volume group ---
  VG Name               VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  76
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               1.08 TB
  PE Size               4.00 MB
  Total PE              283852
  Alloc PE / Size       5258 / 20.54 GB
  Free  PE / Size       278594 / 1.06 TB
  VG UUID               n4NO4a-fLFT-GCO0-PSye-oW06-UWYP-qryubC

[root@ ~]# lvdisplay

  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/MGT
  VG Name                VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a
  LV UUID                uBsbF7-2O3B-S3S2-7t5M-wSCt-b8qu-2AufzM
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                4.00 MB
  Current LE             1
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  currently set to     1024
  Block device           252:1

  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-
438139457a4a/ISORepository
  VG Name                VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a
  LV UUID                Bw8KcC-vexj-WEHx-W3dh-lo8b-UpGu-y7qWB4
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.00 GB
  Current LE             2560
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  currently set to     1024
  Block device           252:0

  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-
8c8064d2-0101-46d4-b1e5-607ad4a92621
  VG Name                VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a
  LV UUID                rCtzAA-VFUZ-tHLP-oJ1D-EHtR-ilXW-RcXwFg
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                10.03 GB
  Current LE             2567
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  currently set to     1024
  Block device           252:2

  --- Logical volume ---
  LV Name                /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-b1f9c38a-042e-4589-8ec5-6389aac8ee4d
  VG Name                VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a
  LV UUID                1Ks1pR-MSbr-U4Q4-bq2T-Py2d-HtUX-0PZnbu
  LV Write Access        read/write
  LV Status              available
  # open                 1
  LV Size                520.00 MB
  Current LE             130
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  currently set to     1024
  Block device           252:3

[root@ ~]# lvcreate -L1G -s -n vmbackup /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-8c8064d2-0101-46d4-b1e5-607ad4a92621
  Logical volume "vmbackup" created

[root@ ~]# lvscan
  ACTIVE            '/dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/MGT' [4.00 MB] inherit
  ACTIVE            '/dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/ISORepository' [10.00 GB] inherit
  ACTIVE   Original '/dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-8c8064d2-0101-46d4-b1e5-607ad4a92621' [10.03 GB] inherit
  ACTIVE            '/dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-b1f9c38a-042e-4589-8ec5-6389aac8ee4d' [520.00 MB] inherit
  ACTIVE   Snapshot '/dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup' [1.00 GB] inherit

[root@ ~]# kpartx -a -v /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup

[root@ ~]# ls /dev/mapper/
control                                                                                                     
VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-VHD--8c8064d2--0101--46d4--b1e5--607ad4a92621-real
VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-ISORepository

VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-VHD--b1f9c38a--042e--4589--8ec5--6389aac8ee4d
VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-MGT

VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup
VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-VHD--8c8064d2--0101--46d4--b1e5--607ad4a92621       VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup-cow

[root@ ~]# mount /dev/mapper/VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup /mnt
mount: you must specify the filesystem type

 [root@ ~]# mount VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup-cow /mnt
mount: you must specify the filesystem type

[root@ ~]# dmesg | tail
[1531258.118928] device vif7.0 entered promiscuous mode
[1531258.515365] blkback: event-channel 8
[1531258.515551] blkback: ring-ref 8
[1531258.515742] blkback: protocol 3 (x86_64-abi)
[1531258.517356] blkback: event-channel 9
[1531258.517446] blkback: ring-ref 9
[1531258.517480] blkback: protocol 3 (x86_64-abi)
[1531258.521059] /local/domain/7/device/vif/0: Connected
[1531265.156744] /local/domain/7/device/vif/0: Connected
[1531265.157147] /local/domain/7/device/vif/0: Closed

[root@ ~]# mount -t ext4 /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup /mnt
mount: wrong fs type, bad option, bad superblock on /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

[root@ ~]# dmesg | tail
[1531258.515365] blkback: event-channel 8
[1531258.515551] blkback: ring-ref 8
[1531258.515742] blkback: protocol 3 (x86_64-abi)
[1531258.517356] blkback: event-channel 9
[1531258.517446] blkback: ring-ref 9
[1531258.517480] blkback: protocol 3 (x86_64-abi)
[1531258.521059] /local/domain/7/device/vif/0: Connected
[1531265.156744] /local/domain/7/device/vif/0: Connected
[1531265.157147] /local/domain/7/device/vif/0: Closed
[1534417.547412] EXT4-fs (dm-4): VFS: Can't find ext4 filesystem

[root@ ~]# fdisk -l /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup
Disk /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup: 10.7 GB, 10766778368 bytes
255 heads, 63 sectors/track, 1308 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup doesn't contain a valid partition table

[root@ ~]# fdisk -l /dev/mapper/VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup-cow
Disk /dev/mapper/VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup-cow: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk /dev/mapper/VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup-cow doesn't contain a valid partition table

[root@ ~]# lsmod | grep ext4
ext4                  312546  0
jbd2                   75354  1 ext4

Here is the summary of the steps I follow:

lvcreate -L1G -s -n vmbackup /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/VHD-8c8064d2-0101-46d4-b1e5-607ad4a92621

kpartx -a -v /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup

mount /dev/VG_XenStorage-2be5fe38-c04b-3277-4ce0-438139457a4a/vmbackup /mnt mount: you must specify the filesystem type

share|improve this question
    
Not really fun to read that. It would be nice to see how you stop the VM and show that you can mount the original volume. –  Hauke Laging Feb 22 '13 at 13:17
    
did you try mounting with -loop ? mount /dev/mapper/VG_XenStorage--2be5fe38--c04b--3277--4ce0--438139457a4a-vmbackup /mnt -o loop ? –  Brigo Feb 22 '13 at 13:39
    
Can you summarise all that without giving all the output from your screen? –  dunxd Feb 22 '13 at 14:22
    
I don't stop VM. If the VM is stopped, kpartx gives me a "failed to stat()". –  Icu Feb 25 '13 at 7:08
    
@dunxd I added the summary of the steps I follow above –  Icu Feb 25 '13 at 7:16

1 Answer 1

up vote 0 down vote accepted

Finally, I made a script based on the following commands:

xe vm-list is-control-domain=false is-a-snapshot=false
xe vm-snapshot of the VMs in the list
xe template-param-set is-a-template=false ha-always-run=false uuid=...
xe vm-export vm=snap_uuid filename=| ssh ... REMOTE_HOST "cat > /path/backup.xva"
xe vm-uninstall uuid=snap_uuid force=true

Thanks for your advices.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.