mount vdi on host

Harald Schmalzbauer h.schmalzbauer at omnilan.de
Wed Nov 23 08:47:38 UTC 2011


Hello,

I'm not subscribed, so I'm not sure this answer will make it onto the
list...

I found your thread "mount vdi on host" and was told about 'gnop' and
'VBoxManage internalcommands dumphdinfo'. That was the key to success,
so I'd like to answer the last question of the thread, when mounting
didn't work: "Any more idea" ... Yes

You forgot that md0.nop is the disk, not the filesystem. You probably
have partitions on it, so when it comes to 'mount' you have to use
/dev/md0nops1a for example (verified with md3.nops1 and mount_msdosfs).

Hope this helps and thanks for the post!

-Harry

Original thread, found via search engine at
http://lists.freebsd.org/pipermail/freebsd-emulation/2011-July/008995.html

--- On Mon, 7/25/11, Brandon Gooch <jamesbrandongooch at gmail.com> wrote:

From: Brandon Gooch <jamesbrandongooch at gmail.com>
Subject: Re: mount vdi
To: "Andrey V. Elsukov" <bu7cher at yandex.ru>
Cc: "Joe Sciulli" <jsciulli2003 at yahoo.com>, freebsd-emulation at
freebsd.org, nox at jelal.kn-bremen.de
Date: Monday, July 25, 2011, 4:31 PM

2011/7/25 Andrey V. Elsukov <bu7cher at yandex.ru>:
> On 25.07.2011 10:18, Joe Sciulli wrote:
>> Is it possible to mount virtualbox vdi file on the FreeBSD host?
This appears to be doable on
>> windows and linux hosts, which basically is done in two steps: 1.
find offset in the image. 2.
>> mount the image with that offset.
>>
>> I'm trying to do the same thing on FreeBSD, and found the
undocumented and deprecated command
>> still works:
>>
>> VBoxManage internalcommands dumphdinfo freebsd_home.vdi
>>
>> I got the following for the virtual disk image holding the /home (no
root hence no MBR) disk for
>> a FreeBSD guest:
>>
>> Header: offBlocks=4096 offData=28672
>>
>> Then attempt to mount it:
>>
>> mdconfig -a -t vnode -f /tmp/freebsd_home_56.vdi -u 0
mount /dev/md0 /tmp/aaa/
mount -t cd9660 /dev/md0 /tmp/aaa/
>>
>> unfortunately both the above two mount commands failed with "Invalid
argument".  I tried
>> skip=28672 to no avail as well.  Anything did I do wrong?
>
> I have not any Vbox images with fixed size, but i tried this:
> # mdconfig -f 10G_GPT_UFS.vdi
> # gnop create -v -o 41472 /dev/md0
>
> where 41472 is offData value. After that md0.nop was tasted and
reports about invalid GPT.
> So, i think if your image is fixed size disk yout can try this method
and mount UFS (not cd9660).
>
> --
> WBR, Andrey V. Elsukov

There was a CFT sent out a while back about a fuse module for mounting
vdi images:

http://lists.freebsd.org/pipermail/freebsd-emulation/2010-September/007964.html

Not sure about the state of this now though...

-Brandon


Thanks for your replies.

I tried

mdconfig -f  freebsd_home.vdi
gnop create -v -o 28672 /dev/md0

Indeed /dev/md0.nop etc were created.  But mounting with the following
commands still yielded the dreaded "Invalid argument" error:

mount /dev/md0.nop /tmp/aaa/

mount -t ufs /dev/md0.nop /tmp/aaa/

One thing interesting is, in the gnop command, if I change 28672 to
anything else such as 28671 or 28673 or whatever, that gnop command
would fail with:

gnop: Invalid offset for provider md0.

so that suggests the offset is correct.  It's just that how to mount it.

The vdi is a variable size disk in virtualbox.  But I had shutdown
virtualbox and copied it to another file before mdconfig on it.

I looked closer at virtualbox-ose-fuse.shar Brandon linked, it appears
to be hardcoded to work with VirtualBox-3.2.8-OSE, while I only have
VBoxGuestAdditions_4.0.12 as in the ports tree.

Any more idea, thanks.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20111123/ff01eec2/signature.pgp


More information about the freebsd-emulation mailing list