Mounting a Windows Host Directory in a Linux Guest via VirtualBox Shared Folders

Prerequisites

Ensure the VirtualBox Guest Additions image (VBoxGuestAdditions.iso) is available. Install essential development utilities within the guest system.

Installing Guest Additions

  1. Log into the Linux guest environment.
  2. Navigate to the virtual machine's menu bar, select "Devices" -> "Insert Guest Additions CD Image...".
  3. Acknowledge the prompt to run the software. If not prompted, proceed manually.

Manual Installation Steps

Create a mount point and attach the Guest Additions image:

sudo mkdir -p /media/vbox_guest_additions
sudo mount /dev/sr0 /media/vbox_guest_additions

Execute the installation script from the mounted directory:

cd /media/vbox_guest_additions
ls -l
sudo ./VBoxLinuxAdditions.run

If the script fails, install required dependencies based on the error message. A typical set of commands includes:

sudo yum install -y bzip2 kernel-devel kernel-headers gcc make
sudo yum update -y

Re-run the installation script after installing dependencies.

Configuring and Accessing a Shared Folder

  1. In the VirtualBox Manager, select the target VM and open its "Settings".
  2. Go to the "Shared Folders" section.
  3. Click the add-folder icon. Specify the absolute path to the directory on the Windows host you wish to share. Assign a name (e.g., win_share) to the folder. Enable the options for auto-mounting and making it permanent. Confirm the setitngs.

Mounting the Shared Folder in the Guest OS

Create a local directory to serve as the mount point and mount the shared folder:

sudo mkdir -p /mnt/shared_windows
sudo mount -t vboxsf win_share /mnt/shared_windows

To verify access, list the contents of the mounted directory:

ls /mnt/shared_windows

Tags: VirtualBox Shared Folders Windows Linux Guest Additions

Posted on Thu, 07 May 2026 06:23:50 +0000 by james13009