On Sun, Sep 14, 2014 at 09:27:46AM +0100, Doug Winter wrote:
I am trying to use guestfs to mount, read-only, a VDI filesystem that is also open, read-write, by a separate Oracle VirtualBox VM.
Opening the filesystem works fine, however changes made to the filesystem in the VirtualBox VM are not reflected in guestfs.
Even unmounting and then mounting the drive again does not show the changes made since the first mount.
However, shutdown() and then launch() of the guests does then show the changes.
I have tried the drop_caches() call, but this doesn't help either (which is kind of unsurprising if unmounting is insufficient).
When I looked into this before, I suspected the reason was because qemu is caching (or maybe the host kernel). You could patch the cache mode (in src/launch-direct.c) so it allows you to use O_DIRECT again and see if that makes a difference. In any case yes, unfortunately you need to shutdown and re-launch the appliance to be sure of seeing changes. One day in the future qemu will be able to export a consistent snapshot of a running guest, and move between snapshots. Work is being done on this upstream.
Is there any way of causing guestfs to see the changes made to the filesystem without going through the slow shutdown/launch process?
See also guestfs-performance(1). If it's taking longer than ~ 5 seconds then there are ways to fix that. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-builder quickly builds VMs from scratch http://libguestfs.org/virt-builder.1.html