Clock Blog
Virtualbox 4.0.4 Shared Folder Update
Continuing from previous blog post, I have benchmarked the newest release of Virtualbox 4.0.4 with Shared Folder access. Same test as before, benchmarking static content servered up by apache from a Shared Folder using the follow command:
$ ab -c 10 -n 500 http://localhost/resource/image/sprite.pngUnfortunately as before I only got sub 200 request per second.
NFS is quicker than Samba
Since my last post I have switched from using Samba to share my host system folders to using NFS. When I run the same benchmark I get 1,189 requests per second! That's nearly 3 times faster than Samba and 6 times faster than Shared Folders. I'm currently using MacOsX as my main desktop environment so setting up NFS was easy:Step 1 - Define what to share over NFS
This is defined in /etc/exports. I wanted to export my /var/application folder which is actually /private/var/application. Here is the contents of my /etc/exports/private/var/application -alldirs -mapall=501:501To edit your /etc/exports open Terminal from Spotlight and edit with root permission:
$ sudo vim /etc/exportsNote that I've added -map-all=501:501 this is UID of my user on my Mac, this ensures that files I create on the Ubuntu guest can be accessed by the host system. You can find the UID of you Mac user in Terminal:
$ id
Step 2 - Reload the NFSD config
$ sudo nfsd update
Step 3 - Install NFS client on guest Ubuntu machine
If you haven't got nfs support you can install it via apt-get$ sudo apt-get install nfs-common
Step 4 - Mount Host Folder via NFS
We mount the host folder in the same location on the guest system i.e. /var/application so we add the following line to /etc/fstab192.168.56.1:/private/var/application /var/application nfs _netdev,auto 0 0The IP address is the address of the host from the host only adaptor. If all went well you should now have your host /var/application folder mount on your guest system. If you run mount you'll see it:
$ mount 192.168.56.1:/private/var/application on /var/application type nfs (rw,addr=192.168.56.1)
Next Step
The next step is to secure your network share so that only your guest can mount it. I've not got round to this yet, if you have please comment. These may help you:man nfsd man exports
NFS Manager is a good paid for GUI app that creates your /etc/exports for you.
So it looks like until Virtualbox fix the bug that is causing Shared Folders poor performance we have no choice but to use NFS to access files on both the host and guest.
Like what you've read?