5

I know there are many questions already about this problem, but all the solutions that people came up with don't work for me. Personally I took the /etc/fstab approach. This is how the content of the file looks like

david@debian:~$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda1 during installation
UUID=e5de59a3-0619-47f9-9a08-858e1e4f6415 /               ext4    errors=remount-ro 0       1
# swap was on /dev/sda5 during installation
UUID=b9140523-9685-48c4-a870-3604a8f58788 none            swap    sw              0       0
/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0
GitHub-VM       /home/david/Documents   vboxsf  uid=david,gid=david,dmode=774,fmode=664     0   0

Where:

  • GitHub-VM: is the folder that I'm sharing from my host system (macOS)
  • /home/david/Documents: is the folder on the VirtualMachine (Debian 8)

Of course I didn't forget to force the vboxsf kernel module to be loaded at boot time.

david@debian:~$ sudo cat /etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
vboxsf

Sadly, after log-in in, my Document folder is not mapped to the host folder :(. What am I missing?

6
  • DId you try unix.stackexchange.com/questions/260481/… as well? Jan 10, 2017 at 19:44
  • That answer is poorly explained can't make much sense of it. If you could maybe edit it to make it more clear, than I could try :) Jan 10, 2017 at 19:48
  • I gave a specific answer instead. Jan 11, 2017 at 7:24
  • Can you mount manually? Jan 15, 2017 at 14:39
  • With Debian host (don't know for MacOSX), the user running virtual-box on the host has to be in group vboxusers, if not virtual box works fine, except for shared folders. Jan 15, 2017 at 14:41

2 Answers 2

2

The mount must happen after vboxadd-service.service is started. Systemd v220 has special fstab options for this, but unless you use backports, with the jessie version you have to create a custom mount unit instead. Put the following in /etc/systemd/system/home-david-Documents.mount:

[Unit]
Requires=vboxadd-service.service
After=vboxadd-service.service

[Mount]
What=GitHub-VM
Where=/home/david/Documents
Type=vboxsf

[Install]
WantedBy = multi-user.target

remove the corresponding line from fstab, systemctl enable home-david-Documents.mount and reboot.

Check your boot log and systemctl status home-david-Documents.mount if it doesn't work.

2

Another way in /etc/fstab GitHub-VM /home/david/Documents vboxsf x-systemd.automount,uid=1000,gid=1000,dmode=774,fmode=664

update-initramfs -u -k all Reboot

sorry correction wrong maschine.

2
  • This works really great, and after running systemctl daemon-reload, somehow automagically create the associated systemd service,
    – Stéphane
    May 22, 2019 at 9:25
  • This worked in getting me past boot but unfortunately, the folder was mounted owned by root, so I need to find some way to fix it... Oct 1, 2020 at 12:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.