Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there a way to mount a directory residing on my VB guest (linux) on my host (linux)? I know I can do it the other way around with the shared folders feature on Virtualbox, but is there a way to do it this way?

I'd really like to actually mount the directory. Not use samba, or something similar to that.

share|improve this question
Perhaps you can mount using sshfs, here is a guide to access a guest using ssh mydebian.blogdns.org/?p=148 – hiena May 25 '11 at 21:43
Are you interested in mounting of working or turned off VM ? – Grzegorz Wierzowiecki Aug 8 '12 at 12:00
up vote 3 down vote accepted

The short answer is that you can't.

When you mount a directory from the host inside the guest, here's what happens. VirtualBox comes with a filesystem driver for the guest OS that stores files by going through a special VM interface rather than directly accessing a storage device. The VirtualBox process on the host interprets the requests that come through the interface by making garden-variety user-level filesystem accesses.

Now consider the symmetric situation. You want to access files on the guest. Ok, then VirtualBox should come with a driver for the guest that handles filesystem queries coming through a VM interface. There would have to be a kernel component (because a VM interface looks like hardware to the guest OS) and optionally a user-land component to actually access the files (not necessarily, this is similar to an server NFS which can be done in the kernel or in userland (an NFS server's front end goes through the network, so that bit is doable in userland)). Then, on the host side, you would need a filesystem driver that communicates through the VM interface. Filesystems are normally handled by the kernel, but they can be mediated to a user process (that's what FUSE does). So a special-purpose filesystem would be possible, but more involved than in the symmetric case. There's also a lot less demand for it. As far as I know, there's no such special-purpose filesystem for any of the major VM implementations.

I'm afraid you'll have to use a networked filesystem such as NFS, Samba or SSHFS.

share|improve this answer
Thanks. It's not really worth my time to go into it that much further at this point. I was just hoping for a quick and dirty method, even if it was a loopback mount or some other nonsense. – Falmarri May 25 '11 at 23:31

Gilles correctly points out the theoretical problems with doing this and notes that there are no current implementations.

The exception would be if you used fixed sizes storage devices AND you are ok with mounting the whole drive while the virtual machine is turned off. In that case this bash script will allow you to mount the VDI disk image file as a drive. You will find lots of information the topic of mounting VDI disk images.

share|improve this answer
That assumes only one concurrent access at a time, right? I mean, I can't mount it, then run the VM. I know there are crazy things I can do, like mount the disk image and possibly use a unionfs. But again, not worth it. The whole point I was going for was to avoid installing KDevelop on my virtual machine =P – Falmarri May 27 '11 at 21:04
Get over it already, if that's the motivation I promise it isn't worth it, just install the software you need in the VM, and if you need to share files setup proper file sharing using either host folder sharing or a network based file system. Seriously :) – Caleb May 27 '11 at 21:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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