Skip to contentSkip to conversation

virtfs root filesystem support

RFC PATCH In review Lennert Buytenhek 2 participants 2 messages Apr 15, 2012 – Apr 19, 2012 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 virtfs root filesystem support

Qemu/KVM provides virtfs, a paravirtualised filesystem that is implemented by running the Plan 9 folder sharing protocol over virtio.

Make booting with root=virtfs:foobar use the virtfs filesystem with mount tag 'foobar' as root filesystem, to allow booting virtual machines off virtfs.

Note that this only handles 9p over virtio (i.e. virtfs), and doesn't attempt to handle mounting 9p filesystems over TCP/IP, for example.

dracut.spec +1 -0
index 074cb10..9cd08b7 100644
@@ -270,6 +270,7 @@ rm -rf $RPM_BUILD_ROOT
 %{dracutlibdir}/modules.d/95zfcp
 %{dracutlibdir}/modules.d/95terminfo
 %{dracutlibdir}/modules.d/95udev-rules
+%{dracutlibdir}/modules.d/95virtfs
 %{dracutlibdir}/modules.d/96securityfs
 %{dracutlibdir}/modules.d/97biosdevname
 %{dracutlibdir}/modules.d/97masterkey
modules.d/95virtfs/module-setup.sh new file +27 -0
new file mode 100755
index 0000000..a6081c2
@@ -0,0 +1,27 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+check() {
+    [[ $hostonly ]] || [[ $mount_needs ]] && {
+        for fs in ${host_fs_types[@]}; do
+            strstr "$fs" "\|9p" && return 0
+        done
+        return 1
+    }
+
+    return 0
+}
+
+depends() {
+    return 0
+}
+
+installkernel() {
+    instmods 9p 9pnet_virtio
+}
+
+install() {
+    inst_hook cmdline 95 "$moddir/parse-virtfs.sh"
+    inst_hook mount 99 "$moddir/mount-virtfs.sh"
+}
modules.d/95virtfs/mount-virtfs.sh new file +75 -0

75 lines not on this page · raw message

modules.d/95virtfs/parse-virtfs.sh new file +7 -0
new file mode 100755
index 0000000..39c4c4c
@@ -0,0 +1,7 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+if [ "${root%%:*}" = "virtfs" ] ; then
+    rootok=1
+fi

A message that is not in the archive (sent off-list or not yet received): 20120415004017.GI28523-OLH4Qvv75CYX/[email protected]

#2 lore raw

Am 15.04.2012 02:40, schrieb Lennert Buytenhek:

Quoted 8 lines

Qemu/KVM provides virtfs, a paravirtualised filesystem that is implemented by running the Plan 9 folder sharing protocol over virtio.

Make booting with root=virtfs:foobar use the virtfs filesystem with mount tag 'foobar' as root filesystem, to allow booting virtual machines off virtfs.

Quoted 6 lines

Note that this only handles 9p over virtio (i.e. virtfs), and doesn't attempt to handle mounting 9p filesystems over TCP/IP, for example.

pushed... and yes we should factor out the mount somehow