KVM Host Guest Filesystem File Sharing [solved]

I am trying to setup file sharing between host and guest and guest to guest.

Host: Ubuntu 18.10
Guest: Ubuntu 18.04

Virtual Machine Manager:
Select Add Hardware
Select Filesystem:
Driver: default
Mode: Squash
Source Path: /mnt/raid/VM-share/Safe
Target Path: VM-share

Boot the VM and run in a terminal,

sudo mount -t 9p -o trans=virtio,version=9p2000.L,rw VM-share /mnt/VM-share

File sharing works.

However when I add this line to fstab the VM will no longer boot,

VM-share /mnt/VM-share 9p trans=virtio,version=9p2000.L,rw 0 0

Second boot after a force reset takes me to maintenance mode where I can hack through vi (still the worst user interface I’ve ever had to use.) to edit /etc/fstab to fix the boot problem.

I think the problem maybe related to apparmour?

Any ideas?

Solved by @TheCakeIsNaOH , add the _netdev to the mount line. Also add nofail to keep the boot from failing unless you like vi. :wink: Here is the working mount for the fstab file.

VM-share /mnt/VM-share 9p trans=virtio,version=9p2000.L,rw,_netdev,nofail 0 0

Shouldn’t it be VM-share /mnt/VM-share and not VM-share share /mnt/VM-share?

Also, you can add nofail to the mount options in fstab so that it will continue booting and not throw you into emergency mode.

1 Like

You are correct, I had saved this config to document when I discovered the boot problem and forgot to update the saved information. I did indeed test without the share without any success.

I should remember to add the nofail by now, I guess I just like vi to much.

It could be trying to mount before networking comes up, try either _netdev option or mounting with systemd. Link below is source-


Thank you, thank you!

_netdev was the missing option. Here is the correct working line for anyone else having this problem.

VM-share /mnt/VM-share 9p trans=virtio,version=9p2000.L,rw,_netdev,nofail 0 0


Here’s something interesting about _netdev I just discovered, apparently it’s more of a tag for scripts to look for, rather than a real argument that does something directly:

So, you are saying that _netdev is not meant to be an argument passed to the process which performs mount (and which is specific to the type of mount like ext4/btrfs/cifs/fuse ) but is meant to be read by other processes/scripts which based upon this flag decide when during the boot process these mounts should be executed. Yes? If so then I suspect this is the reason why this argument starts with underscore so that to differentiate it from other formal arguments. – Piotr Dobrogost May 12 '16 at 12:19

Yes. If you pass the _netdev option to the mount command, it will be visible in /proc/mounts but have no other effect. – Ferenc Wágner May 12 '16 at 14:07

Any more experienced linux guys know if the starting underscore “_” here is a common linux convention for pseudo-arguments, or is it specific to this case?

1 Like