Mounting a VirtualBox dynamic size VDI Image
To work with a variable sized VDI file, you have to dump it to a dd file first (COPYDD); this will create a fixed size dump that then can be opened on a loop device. The variable sized file does not allow mounting as the fs driver needs to see the expected disk size.
So we proceed as follows:
~/.VirtualBox/VDI$ vditool COPYDD win.vdi dump vditool Copyright (c) 2008 Sun Microsystems, Inc.
Then we look where the partition starts, in my case this was a WinXP fat32 formatted filesystem:
~/.VirtualBox/VDI$ hexdump -C -v dump |head -n 30000 |grep -i dos 00007e00 eb 58 90 4d 53 44 4f 53 35 2e 30 00 02 10 24 00 |.X.MSDOS5.0...$.| 00008a00 eb 58 90 4d 53 44 4f 53 35 2e 30 00 02 10 24 00 |.X.MSDOS5.0...$.| ~/.VirtualBox/VDI$
Then we mount it:
~/.VirtualBox/VDI$ sudo mount -o loop,offset=0x7e00,umask=000 -o ro dump /mnt/
3 comentaris per a “Mounting a VirtualBox dynamic size VDI Image”
“So, we proceed as follows”… molt bó mussol!
wow, this is the tutorial I need.. but, I’m using NTFS for my VDI filesystem.. is there any different command for NTFS?
Matt
December 11th, 2009 @ 16:17
Vino,
Probably a few months too late for you, but just replace “dos” with “ntfs” when you grep the hexdump – see below:
~/.VirtualBox/VDI$ hexdump -C -v dump |head -n 30000 |grep -i ntfs
Another thing, vditool has been replaced by VBoxManage
So what you should do is:
VBoxManage clonehd win.vdi dump –variant Fixed



sergi
July 15th, 2009 @ 21:37