Pages

Saturday, May 8, 2010

Virtual Box - Shared Folders in Oracle Enterprise Linux as a guest OS and Windows as Host

clip_image002    It should be work with most Linux environments, but for our case is tested on Oracle Enterprise Linux.
I was trying to install a Oracle Database in a VBOX with OEL Linux as a guest and then I realized that the external disk are no detected automatically.
Then after some research I found what we have to do. The steps below are what I did to enable it.
1. In VirtualBox Add the disk/Folder to be shared. Devices → Shared Folders
clip_image004
2. Add the folders you want to share
clip_image007
You can decide if the folder will be permanent, read-only.
clip_image009
In this example we are adding three folders, one for each Hard disk we have in the Host Operating System. (Our Host OS is Windows)
clip_image011
3. Return to the Guest OS (OEL 5) and open a terminal (Logged as root).
Now we have to create a directory where the Host Folder will be Mount. For our example we have decide to mount these on /media.
clip_image013
4. Now we have to validate if module required is loaded in memory. To do this just do.
lsmod | grep vbox
clip_image015
lsmodvboxvfs must be loaded in memory. If not, please verify that Guest additions were installed on the Operating System Guest. If so, please load the vboxvfs.
clip_image017

Update!!
1.       If this is a new Oracle VM VBox and you need to share files from the guest PC, you need to be sure that the Guest Additions and related packages has been installed and updated.  For that, follow instructions in “CentOS, Red Hat Enterprise Linux and Oracle Enterprise Linux” section of Chapter 4  Guest Additions in the Oracle VM Virtual Box User Manual (http://www.virtualbox.org/manual/). 
 End of Update

Mount -t mount -4. Mount the Folders desidered.
mount -t vboxsf <DRIVE> /localPath
clip_image019
At the end you will be able to see the local directories in your guest OS.
clip_image021
5. If you want to create an script to automate the mount each time you start you Virtual Machine, you can try to create a mount.sh file that should look like this:
echo mounting unit c from Host OS
mount -t vboxsf c_drive /media/cdrive
echo please enter to mount unit f from Host OS
read pausa
mount -t vboxsf f_drive /media/fdrive
echo please press enter to mount unit g from host OS
read pausa
mount -t vboxsf g_drive /media/gdrive
echo You can try now to access the folders
clip_image023
Don’t forget to change the permissions to the file.
#chmod 755 mount.sh
in order to classify the file as executable. Or Graphically  as shown below.

clip_image026

No comments:

Post a Comment