Wednesday, May 7, 2014

Virtual Box: Sharing folders with Windows 8.1 host and Ubuntu guest

I like to do my development on Linux platform, though I love to have my Windows do all the front-end.
For this I run multiple Virtual Boxes with Ubuntu terminal on it. One of the main problems, I faced was sharing of code between the different Virtual Boxes.

To do this, I have shared my Windows user/<user-name>/documents/ directory.

Doing this was not trivial and I have spent many hours trying to fix this.

Step 1:
Share the folder on VBox Settings

Step 2:
You need to install VBox-guest-additions.
This is the place I had the maximum problem.


This should be straight forward but it was not for some reason.
Step 2-a:  This command should have worked
/media/cdrom/VBoxGuestAdditions/BoxLinuxAdditions.run

However no matter what I did, it was not able to detect the CD.

So I looked at alternative steps.
Step 2-b:
sudo apt-get install virtualbox-guest-additions-iso

To check this, we should find that the files are in /opt/VBoxGuestAdditions-4.3.10.
But these files were not there even though the package was showing installed. Tried multiple times to re-install this but no luck.

Step 2-c:
However what this did was that the virtualbox itself got installed on my instance.
With this, I could now find the guestAddition CD on instance itself. So I mounted this
mount -o loop /usr/share/virtualbox/VBoxGuestAdditions.iso  /mnt/vbox/

With this, I could now go to
/mnt/vbox/VBoxLinuxAdditions.run
/mnt/vbox/VBoxLinuxAdditions.run
and thankfully this worked.

Step 3
Mount the disk
sharename="whatever.you.want.to.call.it"; 
sudo mkdir /mnt/$sharename
sudo chmod 777 /mnt/$sharename
sudo mount -t vboxsf -o uid=1000,gid=1000 $sharename /mnt/$sharename
ln -s /mnt/$sharename $HOME/Desktop/$sharename

However I still found a problem and this was
mount: wrong fs type, bad option, bad superblock on hostshare, missing codepage or helper program, or other error (for several filesystems (e.g. nfs, cifs) you might need a /sbin/mount.<type> helper program) In some cases useful info is found in syslog - try dmesg | tail  or so

The problem was that the mount.vboxsf was not linked properly.
ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions/mount.vboxsf /usr/sbin/mount.vboxsf
ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions/mount.vboxsf /usr/sbin/mount.vboxsf

Finally the mount worked.

Step 4: Automount.
In final step, go to
vi /etc/rc.local
sudo mount -t vboxsf -o uid=1000,gid=1000 documents /mnt/<sharename>


Some useful links
https://help.ubuntu.com/community/VirtualBox/SharedFolders
https://help.ubuntu.com/community/VirtualBox/GuestAdditions
http://superuser.com/questions/736024/cannot-share-host-directory-with-virtualbox-guest-mint-16-64-bit

3 comments:

  1. A2 hosting is my web hosting issuer. My enterprise A2Hosting Coupon 2019 and A2 is a Michigan based organization. I've been using them for five years now. I have had a few technical support interactions and that they've been fine. They resolved my issues well. A2 is superb and that i experience very cozy operating with their help team.

    ReplyDelete
  2. On the off chance that you are wanting to utilize Action Server Pages or.ASP, at that point windows based hosting is your lone decision, as UNIX does not support.ASP. Windows Hosting

    ReplyDelete