Tech > VirtualBox


Creating a Debian VM

  1. Download a network install image from
  2. In the `Storage` tab of the VM's settings, select `Empty` under
    `Controller: IDE` in the list of `Storage Devices`.
  3. Select `IDE Secondary Master` for the `Optical Drive` in the list of
    `Attributes` on the right hand side of the dialog.
  4. Click the CD/DVD icon to the right of the `Optical Drive` and select
    `Choose Virtual Optical Disk File...`
  5. Browse to the location of the ISO image downloaded earlier and selet it.
  6. In the `System` tab, change the boot order so that the `Optical` disk is
    booted after the `Hard Disk`.
  7. Click `OK`
  8. Start the VM

-- Frank Dean - 7 Apr 2018

Shared Folders

Note: If /sbin/mount.vboxsf is not present in the VM, install the virtualbox-guest-utils package from the Debian contrib section.

The virtualbox-guest-utils package is not included in the main Debian 9 (Stretch) distribution. It can be installed from the contrib section of Debian Backports

    cat <<EOF | sudo tee -a /etc/apt/sources.list.d/debian-backports.list
    deb stretch-backports main contrib

-- Frank Dean - 11 May 2018

Create a shared folder in the VirtualBox Manager under Settings -> Shared Folders.

Manually mount for read-write as root:

  $ sudo mkdir /media/${MOUNT_POINT}
  $ sudo mount -t vboxsf ${FOLDER_NAME} ${MOUNT_POINT}

For the current user:

  $ sudo mount -t vboxsf -o uid=$UID,gid=`id -g $UID` ${FOLDER_NAME} ${MOUNT_POINT}

To allow a user to write to the shared folder you can add the user to the vboxsf group which should have write access to the shared folder.

$ sudo adduser ${USERNAME} vboxsf

Unmount by unmounting all VirtualBox shared folders:

  $ sudo umount -a -t vboxsf

See man mount.vboxsf for more info.

-- Frank Dean - 22 Apr 2017

Related Topics: LinuxHintsAndTips