mount virtualbox vdi-image on linux

Post Reply
mister_v
Posts: 139
Joined: Sat Jun 20, 2009 5:42 pm

mount virtualbox vdi-image on linux

Post 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.
Chris
Site Admin
Posts: 129
Joined: Mon Jul 21, 2008 9:45 am
Location: Leuven, Belgium
Contact:

Re: mount virtualbox vdi-image on linux

Post 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.
Post Reply