LinuxCommandLibrary

mount.vboxsf

Mount VirtualBox shared folders

SYNOPSIS

The mount.vboxsf utility is typically invoked by the mount(8) command. The effective command syntax when mounting a VirtualBox shared folder is:

mount -t vboxsf share_name mount_point [-o options]

Where:

  • share_name: The name of the shared folder as configured in the VirtualBox Manager.
  • mount_point: The directory within the guest OS where the shared folder will be mounted.
  • options: A comma-separated list of mount options.

PARAMETERS

uid=
    Sets the owner User ID for all files and directories within the shared folder. Defaults to the UID of the user executing the mount command.

gid=
    Sets the owner Group ID for all files and directories within the shared folder. Defaults to the GID of the user executing the mount command.

dmode=
    Sets the file mode (permissions) for directories in the shared folder. E.g., 'dmode=0755'.

fmode=
    Sets the file mode (permissions) for files in the shared folder. E.g., 'fmode=0644'.

iocharset=
    Specifies the character set used for file names, useful for handling non-ASCII characters. Common values include 'utf8' or 'iso8859-1'.

ro
    Mounts the shared folder as read-only, preventing any write operations from the guest.

rw
    Mounts the shared folder as read-write (default behavior), allowing both read and write operations.

exec
    Allows execution of files within the shared folder. This is the default behavior.

noexec
    Prevents execution of files within the shared folder, enhancing security by disallowing arbitrary code execution.

automount
    When used in /etc/fstab, this option signals the VBoxService daemon to automatically mount the shared folder at boot time. This typically implies the share is also marked 'Auto-mount' in VirtualBox settings.

nofail
    When used in /etc/fstab, if the shared folder is not available at boot, the system boot process will continue without an error, preventing boot failures.

DESCRIPTION

The mount.vboxsf command is a specialized helper utility used by the standard mount(8) command to facilitate mounting shared folders from a VirtualBox host system into a Linux guest virtual machine. It is typically not invoked directly by the user, but rather automatically called by mount when the filesystem type (`-t`) is specified as vboxsf. This mechanism provides a convenient and seamless way to share files and directories between the host and guest operating systems, treating the shared host folder as a native filesystem within the guest environment. Its operation relies entirely on the presence and proper functioning of the VirtualBox Guest Additions installed within the guest OS, which provide the necessary kernel modules and user-space components for this inter-system communication.

CAVEATS

  • VirtualBox Guest Additions Required: The functionality of mount.vboxsf is entirely dependent on the VirtualBox Guest Additions being installed and running within the Linux guest OS. Without them, the vboxsf filesystem type will not be recognized.
  • Security Implications: Care must be taken when using options like exec or broad uid/gid mappings, especially if the host content is untrusted. Mounting external content with execute permissions can pose a security risk.
  • Performance Considerations: While convenient, VirtualBox shared folders may not offer the same I/O performance as native filesystems or other network file systems (e.g., NFS, Samba). For very high-performance I/O intensive tasks, alternative sharing methods might be more suitable.
  • Symbolic Link Behavior: Handling of symbolic links within shared folders can sometimes be inconsistent or lead to unexpected behavior, especially when symlinks cross the host/guest boundary or point to paths outside the shared folder.

AUTOMATIC MOUNTING VIA /ETC/FSTAB

Shared folders can be configured to automatically mount at boot by adding an entry to the guest's /etc/fstab file. A typical entry might look like:

share_name /mnt/shared vboxsf defaults,uid=1000,gid=1000,automount 0 0

The automount option, when specified in fstab, leverages the VBoxService daemon to handle the actual mounting process, typically after the network and other essential services are initialized.

SHARE NAMING CONVENTION

The share_name argument used in the mount command must precisely match the "Folder Name" configured for the shared folder in the VirtualBox Manager settings for the virtual machine. This name is case-sensitive, and any mismatch will result in a mount failure.

GUEST USER PERMISSIONS

For a non-root user in the guest OS to be able to mount and access shared folders, that user typically needs to be a member of the vboxsf group. This group is usually created and the current user added to it during the VirtualBox Guest Additions installation. Users not in this group might encounter permission denied errors when attempting to mount or access the shared folder.

HISTORY

The mount.vboxsf utility is an integral component of the VirtualBox Guest Additions, a suite of drivers and system applications designed to optimize the performance and usability of guest operating systems. The shared folder feature was introduced early in VirtualBox's development cycle as a fundamental mechanism for easy file exchange between host and guest. The vboxsf filesystem type and its associated mount helper (`mount.vboxsf`) were developed to integrate this functionality seamlessly with standard Linux filesystem mounting mechanisms. Its evolution has been closely tied to the development of VirtualBox itself, with continuous updates to support new kernel versions and improve stability and performance.

SEE ALSO

mount(8), fstab(5), VBoxService(8), virtualbox(1)

Copied to clipboard