VirtualBox Shared
Folders is a facility provided by VirtualBox hypervisor for
guest operating systems to be able to access host file-system.
To be able to use and configure that feature you need first
to install VirtualBox Guest
Additions. To do that we need follow these steps:
1. Run your Ubuntu 12.04 Virtual
Machine on Virtualbox
2. From the Devices menu select Install
Guest Additions.
3. Now you are supposed to have the guest
additions .iso image in your virtual machine’s CD.
4. Now you might find a problem that is the
cdrom is not automatically mounted, so you need to do one more step before
starting the installation:
$ sudo mount /dev/cdrom /media/cdrom
That will do the trick.
5. Enter the cdrom directory
$ cd /media/cdrom/
6. When listing the contents you should see
something like this:
$ ls -la
total 37429
dr-xr-xr-x 4 root root 2048 2011-06-24 15:45 .
drwxr-xr-x 3 root root 4096 2011-07-17 16:20 ..
dr-xr-xr-x 2 root root 2048 2011-06-24 15:45 64Bit
-r-xr-xr-x 1 root root 647 2011-01-19 14:42 AUTORUN.INF
-r-xr-xr-x 1 root root 7863758 2011-06-24 15:43
VBoxLinuxAdditions.run
-r-xr-xr-x 1 root root 278832 2011-06-24 15:24
VBoxWindowsAdditions.exe
-r-xr-xr-x 1 root root 6199880 2011-06-24 15:25
VBoxWindowsAdditions-x86.exe
7. Let’s run the installation
$ sudo ./VBoxLinuxAdditions.run
NOTE: You might get an error because of the in-existence
of gcc utilities, if so do this step:
$ sudo apt-get -y install build-essential
10. On the Add
Share pop-up window
choose the folder you want to share from your host machine, if you want to make
it read only check the Read-only checkbox, usually we don’t want so. Now check both
the Auto-mount and Make
Permanent, so the mount point
is automatically mount when the Virtual Machine starts.
11. Now the SharedFolder is mounted in the Guest Machine(Ubuntu 12.04), if you
want an immediate effect (which means we can see sf_SharedFolder in /media directory of the Guest Machine), you need
to restart your Virtual Machine.
12. After you restarted your Virtual Machine,
you should find your shared folder mounted under /media directory (because when the Virtual
Machine started, the shared folder will be automatically mounted as you set in
the previous step)
$ ls -la
total 16
drwxr-xr-x 4 root root 4096
2011-07-21 12:23 .
drwxr-xr-x 21 root root 4096 2011-07-17
16:21 ..
drwxr-xr-x 2 root root 4096
2011-07-17 16:20 cdrom
drwxrwx--- 1 root vboxsf 4096 2011-07-21
11:07 sf_SharedFolder
As can be seen in the above block it is
mounted on sf_SharedFolder mount point.
Basically, the folder, in Host Machine (Windows),
which is called "SharedFolder"
you choose to share is mounted as "sf_SharedFolder"
in the Guest Machine(Ubuntu 12.04), and "sf_SharedFolder" is in /media directory.
When you click on
folder, you will get permission denied. Why this happen? It is because your
username in VM is not yet registered in vboxsf
group. All you need to do is add your username into vboxsf group.
$sudo usermod -G vboxsf -a 'name-of-user'
(Note: you need to re-login to make this take effect)
If the system didn't automatically mount the shared folder "SharedFolder to a "/media/sf_SharedFolder" point, which
means you can't find a sf_SharedFolder
folder in /media directory after the above steps, then we can mount it
manually, the steps are:
(1) Create the folder (for example: sf_SharedFolder)
(2) Set the folder's ownership to root:vboxsf with chown
(3) Set "group writable" with chmod
(4) Then mount the folder
Specifically:
(1) $sudo mkdir sf_SharedFolder
(2) $sudo chown root:vboxsf sf_SharedFolder
(3) $sudo chmod g+w sf_SharedFolder
(4) $mount -t vboxsf <SharedFolder> /media/sf_SharedFolder
12. Now we can access the mounted shared folder
through sf_SharedFolder which is located in /media directory in the guest
machine.
Since it is in /media directory where we do
not visit quite often, we can use a symbolic link to link it to a
"better" place like /home directory or Desktop so that we can access
it much easier, we can do this by the below command:
$ln -s /media/sf_SharedFolder /home/UserName/Desktop/vbox_shared
VirtualBox Shared
Folders is a facility provided by VirtualBox hypervisor for
guest operating systems to be able to access host file-system.
To be able to use and configure that feature you need first
to install VirtualBox Guest
Additions. To do that we need follow these steps:
1. Run your Ubuntu 12.04 Virtual
Machine on Virtualbox
2. From the Devices menu select Install
Guest Additions.
3. Now you are supposed to have the guest
additions .iso image in your virtual machine’s CD.
4. Now you might find a problem that is the
cdrom is not automatically mounted, so you need to do one more step before
starting the installation:
$ sudo mount /dev/cdrom /media/cdrom
That will do the trick.
5. Enter the cdrom directory
$ cd /media/cdrom/
6. When listing the contents you should see
something like this:
$ ls -la
total 37429
dr-xr-xr-x 4 root root 2048 2011-06-24 15:45 .
drwxr-xr-x 3 root root 4096 2011-07-17 16:20 ..
dr-xr-xr-x 2 root root 2048 2011-06-24 15:45 64Bit
-r-xr-xr-x 1 root root 647 2011-01-19 14:42 AUTORUN.INF
-r-xr-xr-x 1 root root 7863758 2011-06-24 15:43
VBoxLinuxAdditions.run
-r-xr-xr-x 1 root root 278832 2011-06-24 15:24
VBoxWindowsAdditions.exe
-r-xr-xr-x 1 root root 6199880 2011-06-24 15:25
VBoxWindowsAdditions-x86.exe
7. Let’s run the installation
$ sudo ./VBoxLinuxAdditions.run
NOTE: You might get an error because of the in-existence
of gcc utilities, if so do this step:
$ sudo apt-get -y install build-essential
10. On the Add
Share pop-up window
choose the folder you want to share from your host machine, if you want to make
it read only check the Read-only checkbox, usually we don’t want so. Now check both
the Auto-mount and Make
Permanent, so the mount point
is automatically mount when the Virtual Machine starts.
11. Now the SharedFolder is mounted in the Guest Machine(Ubuntu 12.04), if you
want an immediate effect (which means we can see sf_SharedFolder in /media directory of the Guest Machine), you need
to restart your Virtual Machine.
12. After you restarted your Virtual Machine,
you should find your shared folder mounted under /media directory (because when the Virtual
Machine started, the shared folder will be automatically mounted as you set in
the previous step)
$ ls -la
total 16
drwxr-xr-x 4 root root 4096
2011-07-21 12:23 .
drwxr-xr-x 21 root root 4096 2011-07-17
16:21 ..
drwxr-xr-x 2 root root 4096
2011-07-17 16:20 cdrom
drwxrwx--- 1 root vboxsf 4096 2011-07-21
11:07 sf_SharedFolder
As can be seen in the above block it is
mounted on sf_SharedFolder mount point.
Basically, the folder, in Host Machine (Windows),
which is called "SharedFolder"
you choose to share is mounted as "sf_SharedFolder"
in the Guest Machine(Ubuntu 12.04), and "sf_SharedFolder" is in /media directory.
When you click on folder, you will get permission denied. Why this happen? It is because your username in VM is not yet registered in vboxsf group. All you need to do is add your username into vboxsf group.
$sudo usermod -G vboxsf -a 'name-of-user'
(Note: you need to re-login to make this take effect)
If the system didn't automatically mount the shared folder "SharedFolder to a "/media/sf_SharedFolder" point, which
means you can't find a sf_SharedFolder
folder in /media directory after the above steps, then we can mount it
manually, the steps are:
(1) Create the folder (for example: sf_SharedFolder)
(2) Set the folder's ownership to root:vboxsf with chown
(3) Set "group writable" with chmod
(4) Then mount the folder
Specifically:
(1) $sudo mkdir sf_SharedFolder (2) $sudo chown root:vboxsf sf_SharedFolder
(3) $sudo chmod g+w sf_SharedFolder
(4) $mount -t vboxsf <SharedFolder> /media/sf_SharedFolder
12. Now we can access the mounted shared folder
through sf_SharedFolder which is located in /media directory in the guest
machine.
Since it is in /media directory where we do
not visit quite often, we can use a symbolic link to link it to a
"better" place like /home directory or Desktop so that we can access
it much easier, we can do this by the below command:
$ln -s /media/sf_SharedFolder /home/UserName/Desktop/vbox_shared
No comments:
Post a Comment