How to Mount VirtualBox Disk Image (VDI) to Access VM File-System in Ubuntu

Virtualbox

This tutorial shows how to mount the VirtualBox virtual disk image in Ubuntu, so you can access the Guest OS file system with read and write permission, if it does not boot.

After misconfigured my VirtualBox Guest OS, it does not longer work. I know how to correct the issue to make it boot again, but firstly accessing to the file system is required!

Since the VBox user manual does not work, here’s what I did in Ubuntu 20.04 host with VirtualBox 6.1.x:

Before getting started, make sure Guest OS is shutdown. And the disk image is not in use. Also UN-MOUNT the disk once the job done.

1.) Firstly open terminal from system application launcher. When it opens, run command:

vboximg-mount --list

vboximg-mount is a utility to make VBox disk images available to the host. With --list, it list all Disk Images as well as the UUID.

In the case, I have all Guest OSes on single Disk Image (.vdi). And the uuid is: “3db5fd91-fd56-46af-a2d2-98cd62b05ea3”

2.) Next perform a FUSE mount of the virtual disk image:

  • First create a folder as mount point, vbox_sysdisk for instance:
    mkdir vbox_sysdisk
  • Then mount it via command (remember to change the UUID to yours):
    vboximg-mount -i 3db5fd91-fd56-46af-a2d2-98cd62b05ea3 -o allow_root vbox_sysdisk

NOTE: You may need to edit the “/etc/fuse.conf” to make the -o allow_root flag work. To do so, run command sudo gedit /etc/fuse.conf and enable (remove # at its beginning) “user_allow_other” line.

3.) As the previous picture shows, I have 5 disk partitions: vol0, vol1, …, vol4. Now mount either partition (vol4 for instance) to /mnt via command:

sudo mount vbox_sysdis/vol4 /mnt

Finally go to /mnt directory and there you are.

Unmount:

To un-mount the guest os file system, run command:

sudo umount /mnt

To un-mount the VBox disk image, run command:

umount ~/vbox_sysdisk

And you may finally remove that folder either from file manager or by running command in terminal:

rm -r ~/vbox_sysdisk