Mounting KVM image

Greg Woods woods at
Sat Jun 12 17:54:12 UTC 2010

On Sat, 2010-06-12 at 17:53 +0300, kalinix wrote:


Thank you, this worked. I couldn't do the "easy" way because the loop
module on my systems does not have a max_part parameter and it does not
create the /dev/loop0p* device nodes (it is CentOS 5 rather than Fedora
which is why I haven't asked about this here before, but the subject
came up and did lead to a solution for me; CentOS 5 is basically like a
very old version of Fedora). But the offset method worked so that I
could have the LVM partition directly on /dev/loop0, and then pvscan
could find it. I did have to modify my filters in /etc/lvm/lvm.conf so
that the loop devices would be scanned.

What I really want this for is to be able to restore individual files
from VM images. I back up my virtual machines with a script that pauses
the VM, makes a copy of the disk image, resumes the VM, and moves the
copy to our local mass storage device. Works great except that the only
way to restore individual files from a backup image prior to this was to
actually create a VM from the backup image and boot it. That involved a
lot of manual labor. Works fine when we only have a few test VMs, but if
we end up with dozens or hundreds of VMs in production, I am going to
need something more automated. This can be scripted as I expect the
offset is always going to be the same (or I could be clever and
calculate it from the output of fdisk, then remount with offset). Even
better, if we eventually do make the move from Xen to KVM, the same
techniques should still work.


More information about the users mailing list