[linux-lvm] Mounting an LVM disk image.

Jason Dusek jason.dusek at gmail.com
Tue Jan 19 02:15:58 UTC 2010


  I'm trying to mount a disk image that contains an LVM volume.
  I've managed to follow this tutorial to the point where I've
  got the volume on `/dev/loop7':

    http://www.thegibson.org/blog/archives/467

  Now I want to mount the image. My machine, a CentOS machine,
  is already using LVM; running `lvm pvscan' shows me that the
  the disk image has been stuck in `VolGroup00' with the rest of
  them:

   :; lvm pvscan
    PV /dev/loop7   VG VolGroup00   lvm2 [7.88 GB / 0    free]
    PV /dev/sda5    VG VolGroup00   lvm2 [133.06 GB / 0    free]
    PV /dev/sdb2    VG VolGroup00   lvm2 [135.16 GB / 0    free]
    Total: 3 [276.09 GB] / in use: 3 [276.09 GB] / in no VG: 0 [0   ]

  At this point in the tutorial, I run in to trouble. As they
  suggest, I run `lvm vgchange -ay' and then inspect
  `/dev/mapper':

   :; lvm vgchange -ay
    2 logical volume(s) in volume group "VolGroup00" now active
    2 logical volume(s) in volume group "VolGroup00" now active
   :; ls /dev/mapper/
    control  VolGroup00-LogVol00  VolGroup00-LogVol01

  Mounting fails:

   :;  mount -t ext2 /dev/mapper/VolGroup00-LogVol01 /media/img/
    mount: /dev/mapper/VolGroup00-LogVol01 already mounted or /media/img/ busy
   :;  mount -t ext2 /dev/mapper/VolGroup00-LogVol00 /media/img/
    mount: /dev/mapper/VolGroup00-LogVol00 already mounted or /media/img/ busy
    mount: according to mtab, /dev/mapper/VolGroup00-LogVol00 is mounted on /

  At this point, I'm stuck. I've tried removing `/dev/loop7'
  from the volume group, to no avail:

   :; vgcreate shim /dev/loop7
    Physical volume '/dev/loop7' is already in volume group 'VolGroup00'
    Unable to add physical volume '/dev/loop7' to volume group 'shim'.
   :; vgreduce VolGroup00 /dev/loop7
    Physical Volume "/dev/loop7" not found in Volume Group "VolGroup00"

  What's the right way to mount and LVM disk image? I'm doing it
  to perform maintenance on a Xen guest.

--
Jason Dusek




More information about the linux-lvm mailing list