[zfs-discuss] ZFS under Virtual Machines, Oddities of disk consistency behaviors?

Darik Horn dajhorn at vanadac.com
Mon Dec 19 22:09:20 EST 2011

On Mon, Dec 19, 2011 at 20:01, Christ Schlacta <aarcane at aarcane.org> wrote:
> I'm curious about running Virtual Machines on ZFS.  Currently, all current
> generation virtual machines running linux are installed by default using
> ext4, which is of course journaling.  Is journaling necessary to ensure
> on-disk consistency when the disk is backed by ZFS?

Yes, but it depends on the solution.  I have three different VM
products on my computer, each with a different default risk profile:

  * VMware 7, which enables vmdk write caching by default.  (Unsafe, fast.)
  * Virtual Box 4, which disables vdi write caching by default.  (Safe, slow.)
  * virt-manager + qemu-kvm, which does not create a well-formed qcow2
image on ZFS. (Unsafe, slow.)

> Would it be appropriate to run ext4 with the journal disabled, and/or ext2 in my virtual machines?

No, because journaling does not provide a symmetric benefit in this

Use the defaults, and keep it enabled on both sides, or you could lose
data in-flight or during an in-place rewrite.

> does it matter if I'm using .qcow2 files or zvols, or are the two
> functionally equivalent from a data-consistency standpoint?

Zvols are usually safer and faster, but the implementation in ZoL is
slower than it could be.

If you have time to experiment, then you could try something fancy
like running a single ZFS instance on the host and exporting it to the
VFS of each guest.  The passthrough driver is vmhgfs in VMware and
vboxsf in Virtual Box.  I think that Qemu has something similar in its
virtio drivers too.

Darik Horn <dajhorn at vanadac.com>

More information about the zfs-discuss mailing list