VirtualBox and Shared Folders
I have had problems with Shared Folders in the past, read
here and
here, for just 2 examples.
For my latest project, I decided to skip Shared Folders altogether and just FTP my files to the VM and then load them from a Directory (object). I started to use Telnet and FTP, but was quickly
shamed into using ssh and SFTP. Mostly though, I think I was just lazy initially, or time-crunched, or whatever. I didn't want to bother.
I discovered some new functionality today which means I have to share.
Previously, you had to mount the Shared Folders manually, via something along the lines of:
[root@medicaid oracle]# mount -t vboxsf files oracleFiles
That worked like a charm, or so I thought. I started the process to load files and received an Oracle error (something about couldn't write the log file).
[root@medicaid oracle]# ls -la /u01/app
total 24
drwxrwxr-x 6 oracle oinstall 4096 Mar 3 12:46 .
drwxrwxr-x 3 oracle oinstall 4096 Feb 23 15:32 ..
drwxr-xr-x 8 oracle oinstall 4096 Feb 23 17:14 oracle
drwxr-xr-x 2 oracle dba 4096 Mar 3 12:52 oracleDirectory
drwxr-xr-x 1 root root 4096 Mar 3 16:51 oracleFiles
drwxrwx--- 5 oracle oinstall 4096 Feb 23 16:48 oraInventory
OK, let's change that.
[root@medicaid oracle]# chown oracle:dba -R /u01/app/oracleFiles
No errors.
[root@medicaid oracle]# ls -la /u01/app
total 24
drwxrwxr-x 6 oracle oinstall 4096 Mar 3 12:46 .
drwxrwxr-x 3 oracle oinstall 4096 Feb 23 15:32 ..
drwxr-xr-x 8 oracle oinstall 4096 Feb 23 17:14 oracle
drwxr-xr-x 2 oracle dba 4096 Mar 3 12:52 oracleDirectory
drwxr-xr-x 1 root root 4096 Mar 3 16:51 oracleFiles
drwxrwx--- 5 oracle oinstall 4096 Feb 23 16:48 oraInventory
WTF? Tried it again (yes, I know the definition of insanity). No joy.
What's this, a help button? Let's see what it says. From the
docs:
Starting with version 4.0, VirtualBox can mount shared folders automatically, at your option. If automatic mounting is enabled for a specific shared folder, the Guest Additions will automatically mount that folder as soon as a user logs into the guest OS. The details depend on the guest OS type:
With Windows guests, any auto-mounted shared folder will receive its own drive letter (e.g. E:) depending on the free drive letters remaining in the guest.
If there no free drive letters left, auto-mounting will fail; as a result, the number of auto-mounted shared folders is typically limited to 22 or less with Windows guests.
With Linux guests, auto-mounted shared folders are mounted into the /media directory, along with the prefix sf_. For example, the shared folder myfiles would be mounted to /media/sf_myfiles on Linux and /mnt/sf_myfiles on Solaris.
The guest property /VirtualBox/GuestAdd/SharedFolders/MountPrefix determines the prefix that is used. Change that guest property to a value other than "sf" to change that prefix; see the section called “Guest properties” for details.
Ah, there it is. Neat.
[oracle@medicaid]$ ls -la /media/sf_files
Permission denied
Oh, a note:
Note
Access to auto-mounted shared folders is only granted to the user group vboxsf, which is created by the VirtualBox Guest Additions installer. Hence guest users have to be member of that group to have read/write access or to have read-only access in case the folder is not mapped writable.
That helps.
Based on some feedback in the comments, I am not 100% sure the following command (usermod) is accurate. Until I can research this, please see the comments.[root@medicaid oracle]#/usr/sbin/usermod -G vboxsf oracle
Exit out of root, still no joy. Issued the
id command, and there is my group listed...So what did an ex-Windows user do? Reboot.
That worked. I now have access to these super cool auto-mounted Shared Folders. Thanks VirtualBox!
Labels: howto, oel, oradb, virtualbox