Under Windows, there has already been a driver for mounting Virtualbox VDIs under Windows, called ImDisk
(which I have never tried). For Linux, there was a default method using losetup
(which I also didnt try, because it sounded like these hacky solutions that often fail and break your whole virtual disk).
Anyway, meanwhile, Ubuntu has a package named virtualbox-ose-fuse
, containing a tool called "vdfuse", which creates a fuse filesystem containing a file that can be loopmounted (the partitions are added, but I prefer kpartx).
The command is self-explaining and trivial to use, a little bit of configuration for fuse is necessary, but thats all. A pretty useful tool.