I've been setting up a new development environment using VirtualBox so I can sandbox my services and such in their own VM. It's an Ubuntu-based VM, which loads as a headless instance that I SSH into from the host machine.

What I'd like to do is store all my project files on the host machine and then share them with the guest VM. I can do this easily enough with the following command:

sudo mount -t vboxsf <name> <target_path>

This works perfectly. However, it's a bit of a pain to have to run that command every time I start the VM. It means I have to start it, ssh in, execute command and restart my various services which require access to the data stored on the host machine (postgresql, apache, mongo, etc...).

I figured using fstab would be the best route, so I went about adding the following entry to the list:

# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
HostWWW /home/wilhelm/www vboxsf

Easy enough, right? Well, I save and exit, reboot the VM, SSH back in, navigate to the mount point for the shared folder and it's still empty. I do a quick ls -lsa and get nothing. So, I run the following command to see if it's actually been mounted:

mount -v

and I see the following line within the resulting list of mount points:

HostWWW on /home/wilhelm/www type vboxsf (rw)

Now, correct me if I'm wrong, but this should tell me that it actually has been mounted with read/write access. Now, if I REmount the share again with the same command as above, everything works just fine.

Not sure what I'm doing wrong here; how can I fix this?

  • Disable Auto-mount on the shared folder in VirtualBox Manager.
  • Add the following line to /etc/fstab:

    HostWWW /home/wilhelm/www vboxsf defaults 0 0

It will work like a charm.

  • Thanks for the feedback, buddy! I haven't had this issue for a while now. I've been using Vagrant for the past year and haven't had any issues. – Wilhelm Murdoch Jun 8 '13 at 8:36

Well, turns out this was easily resolved by adding that command to /etc/rc.local. Would still like to get fstab properly working.

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.