How to mount a VirtualBox disk image (VDI) to access a VM file system on Ubuntu

This tutorial shows how to mount a VirtualBox virtual disk image on Ubuntu. This allows you to access with read and write permissions if the guest operating system file system does not boot.

I made a mistake in configuring the VirtualBox guest operating system and it stopped working. I know how to fix the problem and reboot, but I need to access the file system first.

Here’s what I did on an Ubuntu 20.04 host with VirtualBox 6.1.x because the VBox user manual doesn’t work:

Make sure the guest operating system is shut down before you start. Also, no disk image is used. Also, unmount the disc when the job is complete.

1.) First, open a terminal from the system application launcher. Once open, run the following command:

vboximg-mount --list

vboximg-mount is a utility that makes VBox disk images available to hosts.so --list, All disk images and UUIDs are listed.

In this case, all guest operating systems are on a single disk image (.vdi). The uuid is “3db5fd91-fd56-46af-a2d2-98cd62b05ea3”.

How to mount a VirtualBox disk image (VDI) to access a VM file system on Ubuntu

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

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

How to mount a VirtualBox disk image (VDI) to access a VM file system on Ubuntu

Note: Edit “/etc/fuse.conf” and -o allow_root Flag work. To do this, run the command sudo gedit /etc/fuse.conf and enable the “user_allow_other” line (remove the first #).

How to mount a VirtualBox disk image (VDI) to access a VM file system on Ubuntu

3.) As shown in the previous figure, there are 5 disk partitions, vol0, vol1,…, vol4. Mount one of the partitions (for example, vol4) on / mnt using the following command:

sudo mount vbox_sysdis/vol4 /mnt

How to mount a VirtualBox disk image (VDI) to access a VM file system on Ubuntu

Finally, go to the / mnt directory and you’ll be there.

Unmount:

To unmount the guest operating system file system, run the following command:

sudo umount /mnt

To unmount the VBox disk image, run the following command:

umount ~/vbox_sysdisk

You can then run the following command from the file manager or in the terminal to finally delete the folder:

rm -r ~/vbox_sysdisk

Share this:

  • More
Sidebar