Can I run a KVM guest with a btrfs subvolume as file system?

I want to run a virtualized Debian stable KVM guest on a Debian stable host (to run untrusted stuff like Skype, Flash or eclipse with third-party plugins). Naturally host and guest will have many files in common and it would be nice to make us of btrfs deduplication.

Now I found "direct kernel boot" but I could not find any documentation about it. Does it allow me to hand a btrfs subvolume of the host file system to the guest and the guest uses this subvolume as its own file system?


@ignis is correct. No, you cannot use a btrfs snapshot subvolume of a host on a guest. btrfs merges the filesystem and block layers. A subvolume is not a block device; it is a filesystem.

In the LVM world you take snapshots of block devices and these snaps are block devices as well. Such a snap could be used as a root device for a guest (as long as the snap isn't mounted on the host).

You could mount the snap subvol on the host and export it via NFS and boot the guest with an NFS root but that would be awkward.

Based on your usage scenario I recommend looking into Linux Containers (LXC) (and Docker). LXC will provide the isolation and identical-file re-use you are looking for.