Wanted to get at a file in a VirtualBox guest OS without starting up the system in question. The data was stored in a .vdi file (dynamic). It turns out that one can mount such .vdi files using some qemu tools.
From thkala's answer on serverfault:
To determine the relevant partition device node I used cfdisk on /dev/nbd0, but it may be that a simple use of the blkid command may be enough. partprobe may or may not be necessary after the first qemu-nbd invocation.
I first learned about this approach via How to mount a VirtualBox VDI image, but the specific instructions in the main post didn't quite work (though with modifications suggested in the comments things worked out).
From thkala's answer on serverfault:
Quote
First you make sure that the nbd kernel module is loaded with the max_part option set to a number high enough to accommodate all the partitions in your .vdi image:
# rmmod nbd
# modprobe nbd max_part=16
Then you use qemu-nbd to attach the image:
# qemu-nbd -c /dev/nbd0 test.vdi
You will get a /dev/nbd0 block device, along with several /dev/nbd0p* partition device nodes. You use them as any other disk. Once you are done, you unmount everything, and disconnect the device:
# qemu-nbd -d /dev/nbd0
To determine the relevant partition device node I used cfdisk on /dev/nbd0, but it may be that a simple use of the blkid command may be enough. partprobe may or may not be necessary after the first qemu-nbd invocation.
I first learned about this approach via How to mount a VirtualBox VDI image, but the specific instructions in the main post didn't quite work (though with modifications suggested in the comments things worked out).






