6

I am trying to copy an LVM logical volume with an ext3 filesystem from one system to a file on another system that I will be able to mount as a loopback device. I have tried the following command to copy the volume:

dd if=/dev/VolGroup01/example-volume bs=1M | ssh target-system dd of=/backup/example-volume-image bs=1M

This gives me a file with the same size as the logical volume however when I try to mount it I get:

[root@target-system backup]# mount -o loop example-volume-image /mnt
mount: you must specify the filesystem type
[root@target-system backup]# mount -o loop -t ext3 dev2-endeca1-rootfs /mnt
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

Am I not copying the volume correctly or is it just possibly corrupt?

Dave Forgac
  • 3,546
  • 7
  • 37
  • 48
  • What is the filesystem type of the original volume? – Michael Hampton Aug 09 '12 at 20:17
  • Sorry, it's ext3 – Dave Forgac Aug 09 '12 at 20:18
  • Is there anything related to the failed mount operation in `dmesg` output? – Alex Aug 09 '12 at 20:34
  • Nothing in `dmesg` but there is this in `/var/log/messages`: `Aug 9 16:38:18 target-system kernel: hfs: unable to find HFS+ superblock`. Going to try creating the snapshot per answer below. – Dave Forgac Aug 09 '12 at 20:42
  • So it turned out that the volume I was trying to copy was an old Xen disk image, not just a normally formatted partition. I was able to mount it using `losetup` as described here: http://blog.leenix.co.uk/2010/07/howto-mount-kvmxen-virtual-disk-image.html – Dave Forgac Aug 10 '12 at 20:08

1 Answers1

4

If it is a running lvm, you should create a snapshot of it, and then back up the snapshot. Otherwise your command looks fine. It is better if you unmount the lvm before doing the copying.

Then, force a filesystem check on the resulting loop file before attempting to mount.

johnshen64
  • 5,865
  • 24
  • 17
  • It turned out that my issue was due to the LV being a Xen disk image however this would be the preferred method of copying an LV to a disk image file. – Dave Forgac Aug 10 '12 at 20:09