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
2. Add the folders you want to share
You can decide if the folder will be permanent, read-only.
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)
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.
4. Now we have to validate if module required is loaded in memory. To do this just do.
lsmod | grep vbox
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.

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 ( 
 End of Update

Mount -t mount -4. Mount the Folders desidered.
mount -t vboxsf <DRIVE> /localPath
At the end you will be able to see the local directories in your guest OS.
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 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
Don’t forget to change the permissions to the file.
#chmod 755
in order to classify the file as executable. Or Graphically  as shown below.


No comments:

Post a Comment