Registering from Shared Folders menu of Virtualbox GUI the required directory but NOT automounting it or permanent mounting from Virtualbox. Note if you have directories with odd names or dashes (-) in them then use systemd-escape to find the appropriately escaped name.Īfter an exhausting morning trying all the above in Ubutntu 16.04 running in Virtualbox 5.0.20 unsuccessfully (particularly disappointed that the rc.local solution didn't work), it worked by: If you want mount them immediately (provided the Shared Folders have been created) you can do so: sudo systemctl start my_mount-src_host.mount Sudo systemctl enable my_mount-src_host.mount Then they need enabling: sudo systemctl enable my_mount-src_tomount Options=defaults,noauto,uid=1000,gid=1000ĭescription=Auto mount shared "src" folder to match the fstab mount point above they would be named my_mount-src_host.mount and contain: ĭescription=VirtualBox shared "src" folder To do so create two entries in /usr/lib/systemd/system/ named after your desired mount point e.g. However for the above to work on some systems you need to check the 'Auto-mount' box in VirtualBox's Shared Folders->Add dialogue, which means you can end up with a few duplicate mounts of the directory.įor a cleaner mount - without duplicate directories nor the need for 'Auto-mount' - you need to use systemd's mount and automount directives. In recent releases of Virtual Box we can also automatically mount shared folders on creation:Īfter a reboot of the guest this shared folder will be mounted to the guest directory /media//sf_ accessible to all users who had been made member of the group vboxsf.įor newer systemd based systems you need alternative approaches - the simplest being one mentioned in another answer to another question - which basically says that you need to add a special comment option to the /etc/fstab entry: src /my_mount/src_host vboxsf auto,rw,comment=tomount 0 0 Mount with Virtual Box "automatic mounting": Some systems may need option comment=tomount in their fstab entry ( source). It may then help to append the vboxsf kernel module to /etc/modules. On some systems the vboxsf kernel module is not yet loaded at the time fstab is read on boot. One possibility is to mount with defaults, or to give specific mount options (e.g. Replace name_of_share and /path/to/mountpoint with your individual setup (the directory for the mountpoint has to be created first). Then we may put the following line in our etc/fstab file: /path/to/mountpoint vboxsf 0 0 To mount a shared folder using the vboxsf filesystem provided with Guest Additions we first need to make sure prerequisites are met. It is up to personal preference which option works best in our setting. To always mount a Virtual Box "shared folder" on booting an Ubuntu guest we have two options.