Page 1 of 1

mount virtualbox vdi-image on linux

Posted: Sat Dec 29, 2018 7:53 pm
by mister_v
Hello,

How do I mount virtualbox vdi-image on linux?

I tried:

Code: Select all

mount kubuntu.vdi /mnt/test/
But it didn't work.

Re: mount virtualbox vdi-image on linux

Posted: Sat Dec 29, 2018 8:31 pm
by Chris
You probably having a dynamically sized .vdi file.

You first have to convert it:

Code: Select all

VBoxManage clonehd --format RAW kubuntu.vdi kubuntu.img
Remember the img-files is that a full disk, so with different partitions.
Check it with:

Code: Select all

fdisk -l kubuntu.img
You should be able to mount it with something like this :

Code: Select all

mount -t ext3 -o loop,rw,offset=1048576 kubuntu.img /mnt/test
The offset is the start of your partition (usually 2048 for the first) multiplied by sector size (mostly 512), so 1048576 for mine.

Of course you won't be able to edit any files on this.
Well you can but it is on the img-file and not on the vdi-file.

If you need to edit, I suggest you add the vdi-file as a second drive to another virtual machine.

There are other tools like vdfuse,
or using qemu and qemu-nbd to mount it.
But I haven't use them.