[Libguestfs] Possible to speed up guestmount?
Pino Toscano
ptoscano at redhat.com
Thu Feb 6 10:32:24 UTC 2014
Hi,
On Thursday 06 February 2014 02:53:05 Patrick Schleizer wrote:
> Apparently,
>
> guestmount -o allow_other -a "/path/to/raw_file" -m /dev/sda1
> "/path/to/mountfolder"
>
> is much slower than
>
> kpartx -av "/path/to/raw_file"
> mount /dev/mapper/loop0p1 /path/to/mountfolder
>
> (Doing lots of read/write inside the image.)
>
> I thought guestmount "only" scripts the above. Seems I was wrong on
> that.
As also described in our documentation[1], libguestfs uses a virtual
machine to handle the images. It does so also to not require root
permissions on your host (which you need when using kpartx+mount), and
to isolate the host from whatever is into the image [2].
[1] http://libguestfs.org/guestfs.3.html#architecture
[2] http://libguestfs.org/guestfs.3.html#security
> Seems my version is higher than 1.13.16, so far so good. I am using
> guestmount inside a virtual machine (to prevent damaging my hosts due
> to own stuff).
Since libguestfs uses a VM internally already, you could avoid this
step. VM-in-VM certainly makes things slower too.
> It's a sparse raw image (because the tool I am using to create them
> (grml-debootstrap [3]) can only create raw images).
>
> With guestmount,
>
> time sudo chroot /path/to/mountfolder sudo -u user echo test
>
> takes ~1 second. In comparison, doing the same using kpartx/mount only
> takes ~0.01 seconds.
Note also guestmount uses FUSE to mount the provided image using
libguestfs, so there is also an additional layer between the commands in
the mountpoint and the actual access to the data in the image.
--
Pino Toscano
More information about the Libguestfs
mailing list