Search This Blog

Showing posts with label VIrtual Box. Show all posts
Showing posts with label VIrtual Box. Show all posts

Friday, March 5, 2010

How do I automount my virtual box shared folder in an Ubuntu guest?

I'm a big fan of VirtualBox and I run a whole bunch of virtual machines based on Ubuntu.  One of vbox's features is to allow the virtual machine access to the host's file system.  I always forget how to do it and have to troll the web for a solution.  I've done this enough times that I figured I should save myself some time and outline the steps here:
  • mkdir share
  • sudo mount -t vboxsf -o uid=1000,gid=1000 sharename mountpoint The user id and group id should be adjusted to match your account's numbers.
  • put into /etc/rc.local this line:  mount -t vboxsf -o uid=1000,gid=1000 .  This will remount the share during boot up. Notice how we didn't have to specify sudo in this case.
Replaced the user and group ids to match your account's ids. Many thanks to this blog post which gave me most of the information I needed.

Wednesday, January 6, 2010

How Do I Expand A Virtual Box Drive?

I just wanted to give a quick thanks to Seppe vanden Broucke whose blog post on how to expand a virtual drive saved me a whole bunch of time.  When I do Java development I typically use a virtual machine to host the environment.  I find it useful because you can quickly replicate/archive the environment.  I set up a Xubuntu environment that ran out of disk space and caused all sorts of trouble for me.  Thanks to Seppe I was up an running within an hour with a newly expanded virtual drive.

Thursday, December 10, 2009

How do I access a shared folder in Virtual Box under an Ubuntu guest?

I use Virtual Box everyday and love it. One of its nice features is the ability to expose the host's file system to the guest OS. When running an Ubuntu Linux guest, however, you need to make a few hand tweaks to get the shared folder to automatically mount.

First, we need to test that we can mount the folder by hand. Examine the shared folder settings of your VM to find the name of the share. Mine has the very original name of share. Create a directory that will be used as the mount point for the shared folder. I created ~/vbox. Finally, mount the shared folder to the Ubuntu file system using the following command:

sudo mount -t vboxsf share ~/vbox

Do an ls of ~/vbox to verify that your shared files exist. If you do an ls of the mount directory, you'll notice that it is owned by root which could be a problem if you try to write to that folder. We need to fix that. Unmount the share using sudo umount ~/vbox/ so we can make some adjustments. Remount the shared folder using a slightly different set of options: sudo mount -t vboxsf -o uid=1000,gid=1000 shared ~/vbox. In this variant, I specified my account's user and group ids. Now the directory is mounted with the proper permissions.

I want this done automatically each time I boot up, so I placed the following in my /etc/rc.local file:

mount -t vboxsf -o uid=1000,gid=1000 RKurr /home/rkurr/vbox/

I have to use the fully qualified path to the mount point because the root user will be running the command and ~ will not expand correctly.