How to boot from virtiofs

This document describes how to boot from a virtiofs root file system.

A guide for manually running QEMU with virtiofs is available here. It covers how to compile virtiofs software components. This document assumes you have compiled virtiofs.

virtiofs can be used to share directories between the host and the guest. Frequently these are "data" directories that do not contain the root file system. Sometimes it is useful to boot the root file system itself from virtiofs.

When a guest boots from virtiofs it does not require a disk image file. This is convenient when changes are made to the root file system periodically and rebuilding a disk image file each time would be slow.


The instructions assume that you already have available a Linux host on which you can build and run the components.

Creating a Fedora root file system

Install a basic Fedora root file system as follows:

# mkdir virtio-fs-root
# dnf --installroot=$PWD/virtio-fs-root --releasever=29 install system-release vim-minimal systemd passwd dnf rootfiles
# $EDITOR virtio-fs-root/etc/shadow # set password or allow password-less root login

Booting from virtiofs

Start the virtiofs daemon:

# virtiofsd --socket-path=/tmp/vhostqemu -o source=virtio-fs-root -o cache=none

The following QEMU options are required:

This assumes you are using a monolithic kernel. Use of an initramfs has not been tested and may require further steps.

For details on launching QEMU, see the QEMU HowTo.