TimeLinux1

Saturday, February 16, 2013

VirtualBox Shared Folder Fedora 18 Guest on OSX Host

In todays article we are going to review the steps required to share folders between two Operating Systems running VirtualBox (VB) on the same machine.

First what is VirtualBox?

VirtualBox (VB)is a very useful desktop virtualization tool from (previously) Sun Microsystems (and now Oracle).
To download VB you can go to https://www.virtualbox.org/ .

In our setup the Host OS is OSX 10.8 and the guest OS (running inside VB) is Fedora 18. Both are 64Bit OS in our case.


[[Note: The article assumes that you have a similar setup and that you have already installed VB and Fedora guest on top of the OSX host. If not, then for installation steps, go here for a text tutorial or here for a video tutorial before proceeding further.]]


We have a folder on our host (OSX) Desktop called 'documents' that we want to access from within the Fedora guest at a mount point directory called '/home/mrinal/doc_osx'


The first thing we need to do is to define the shared folder.

For that click the 'Devices' menu on the top of the VB window, and then click 'Shared Folders...'
This opens a popup where you define the host folder to share (in our case called documents) and the path for the same.

The next thing to do is to install the VBGuest Additions to the Guest OS (Fedora 18).

This is because the default installation of VB doesnt come with the necessary modules for sharing folders, mouse integration, display integration etc.

So, to do that open a terminal window on your Fedora guest and su - to root

$ su -
password:
#  yum install dkms binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel

This downloads and installs the necessary kernel modules and mounts the iso for the guest addition

In my case, the  Guest Additions were mounted under this path by default:


/run/media/mrinal/VBOXADDITIONS_4.2.6_82870/   

[[Note:  you should be able to see it in the output of mount / df -Th 

Also, the correct version of VBox Additional modules for Fedora 18 is 4.2.6.xyz ]]

So I went in that directory,

[root@fedora18 ~]# cd /run/media/mrinal/VBOXADDITIONS_4.2.6_82870/

And ran the shell script to install the Guest Additions as follows:


[root@fedora18 VBOXADDITIONS_4.2.6_82870]# ./VBoxLinuxAdditions.run 

Verifying archive integrity... All good.
Uncompressing VirtualBox 4.2.6 Guest Additions for Linux..........
VirtualBox Guest Additions installer
Removing installed version 4.2.6 of VirtualBox Guest Additions...
Removing existing VirtualBox DKMS kernel modules           [  OK  ]
Removing existing VirtualBox non-DKMS kernel modules       [  OK  ]
Building the VirtualBox Guest Additions kernel modules     [  OK  ]
Doing non-kernel setup of the Guest Additions              [  OK  ]
Starting the VirtualBox Guest Additions                    [  OK  ]
Installing the Window System drivers
Installing X.Org Server 1.13 modules                       [  OK  ]
Setting up the Window System to use the Guest Additions    [  OK  ]
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

Installing graphics libraries and desktop services componen[  OK  ]

[root@fedora18 VBOXADDITIONS_4.2.6_82870]# 

[[Ensure you didnt receive any errors or 'FAILED' status messages, if you do, then look at the log files under /var/log directory. The log file is vboxadd-install.log]]


Assuming all went well so far, now the only thing remaining to do is to mount the shared folder on your guest.

You can do that only as root (or sudo)

[[As Root]]

[root@fedora18 ~]# mount -t vboxsf -o rw documents /home/mrinal/doc_osx

[[As regular user mrinal via sudo]]

[mrinal@fedora18 ~]$ sudo mount -t vboxsf -o rw,uid=1000 documents /home/mrinal/doc_osx

Also:

Not recommended to automount in /etc/fstab as it hangs the guest at boot.
So if you reboot, you need to mount the share manually again. Perhaps you can automate via an init script in /etc/init.d directory.

Anyway, hope you found this article useful...



No comments:

Post a Comment