This document describes how to boot from a virtio-fs root file system.
A guide for manually running QEMU with virtio-fs is available here. It covers how to compile virtio-fs software components. This document assumes you have compiled virtio-fs.
virtio-fs 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 virtio-fs.
When a guest boots from virtio-fs 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.
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
Start the virtio-fs daemon:
# virtiofsd -o vhost_user_socket=/tmp/vhostqemu -o source=virtio-fs-root -o cache=none
The following QEMU options are required:
-append "rootfstype=virtio_fs rootflags=default_permissions,allow_other,user_id=0,group_id=0,rootmode=040000,dax root=myfs rw"(note that Linux 4.19-based virtio-fs kernels required rootflags=tag=myfs,... root=none instead of root=myfs)
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.