[ovirt-users] direct mounting of vm disks?

Robert Story rstory at tislabs.com
Mon Jun 27 14:57:29 UTC 2016


So as (bad) luck would have it, I needed to restore an older backup that
the one I initially used. This time I decided to dig deeper into this
possibility, and got it working. libguestfs took care of all the dirty work,
even with dealing with snapshots and thin provisioning. Here's what I did:

- yum install libguestfs libguestfs-tools-c
- find the disk id
  - via GUI 'Disks' tab, search for VM in 'attached to' column, copy disk ID
- shut down vm
- on nfs server
  - switch to the directory for the ID found above
    - e.g. cd /srv/ovirt/storage/*/images/$ID/
  - find latest modified file: ls -lt
  - mount it: guestmount -a $last_modified_file -m /dev/vg_el7/root /mnt/tmp
  - start restore
    - cd /mnt/tmp
    - ionice -c 3 tar xvf /tmp/backup.tar

Average load on my NFS server for about 12 VMs is generally less than 1.
During the initial restore over the weekend, run on the VM, restore took 5
hours and the load climbed up to 16. I'm running the new restore now, and
the load is holding steady at just under 2.

Robert


On Sun, 26 Jun 2016 12:27:24 +0000 Scott wrote:
S> Hi Robert,
S> 
S> I've modified disk images for oVirt virtual machines before.  I mostly run
S> servers so they all use preallocated as opposed to thin provisioned disks.
S> I'm not sure if that matters, but it means my VM disk images are raw files
S> (as opposed to qcow).  Therefore, I used something like the following guide
S> to get into the disk image.  These directions don't use kpartx or
S> libguestfs, but I guess those would work too.  I think it goes without
S> saying, your VM should be off before you modify its disk without its
S> knowledge.
S> 
S> https://major.io/2010/12/14/mounting-a-raw-partition-file-made-with-dd-or-dd_rescue-in-linux/
S> 
S> For me, the biggest problem I had was the partition in the disk image was
S> really an LVM PV.  And that LVM group had the same volume group name as one
S> on the server I was doing this modification.  I had two volume groups with
S> the same name, which made things a little tricky.  But I'll leave that to
S> you to figure out :)
S> 
S> Scott
S> 
S> On Sat, Jun 25, 2016 at 11:41 PM Robert Story <rstory at tislabs.com> wrote:
S> 
S> > Hello,
S> >
S> > I'm using oVirt 3.5.x w/nfs for vm file storage. I'm trying to restore a vm
S> > from backup, which entails:
S> >
S> >  - scp backup.tar to vm
S> >  - untar backup on vm
S> >
S> > this means all the data makes 3 trips over the network, each of which
S> > causes a load spike on my nfs server. That nfs load, of course, affects all
S> > other vms.
S> >
S> > what I'd like to be able to do is
S> >
S> >  - scp backup.tar to nfs server
S> >  - stop vm
S> >  - mount vm disks on nfs server
S> >  - untar backup on nfs server (using ionice to minimze load impact)
S> >  - unmount vm disks
S> >  - start vm
S> >
S> > I remember that I used to use kpartx to mount regular KVM disks, so I'm
S> > hoping that it can also be done here. Anyone else tried to make this work?
S> >
S> >
S> > Robert
S> >
S> > --
S> > Senior Software Engineer @ Parsons
S> > _______________________________________________
S> > Users mailing list
S> > Users at ovirt.org
S> > http://lists.ovirt.org/mailman/listinfo/users
S> >  



Robert

-- 
Senior Software Engineer @ Parsons
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.ovirt.org/pipermail/users/attachments/20160627/ea1241f7/attachment-0001.sig>


More information about the Users mailing list