Discuss: Mount any VBox-compatible disk image on the host

Discussions related to using VirtualBox on Linux hosts.
Post Reply
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Re: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Post by TerryE »

Sorry, I'll do it tomorrow. I've been debugging some horrible utilities to automate a bunch of forum stuff. Alternately can't you just upload it as an attachment?
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
rainbow.hippie
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

Re: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Post by rainbow.hippie »

h2o wrote:Update 2/12/09: Use this, it's better http://forums.virtualbox.org/viewtopic. ... 9678#59678
1) Get the package nbd:
On Ubuntu:

Code: Select all

apt-get install nbd-client
2) Compile it
Download it, compile it with:

Code: Select all

gcc vdimount.c -o vdimount -pthread -l:/path/to/virtualbox/VBoxDD.so -Wl,-rpath,/path/to/virtualbox -I/path/to/includes/for/virtualbox
I've installed nbd-client and run '' gcc vdimount.c -o vdimount -pthread -l:/usr/lib/virtualbox/VBoxDD.so -Wl,-rpath,/usr/lib/virtualbox -I/usr/bin '' (according to my installation of VirtualBox).
It ends with following error message: '' gcc: vdimount.c: No such file or directory ''
I allready expected this error message, because how should gcc know of any vdimount.c ? I don't know where I could find this vdimount.c (I searched all /usr for this file, no where).

Anybody an idea?

Thanks, Ulrich
mlafauci
Posts: 5
Joined: 31. Mar 2009, 00:15
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: Windows XP Ubuntu

Re: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Post by mlafauci »

Is it possible to mount the VDI file automatically at the system startup?
for example using /etc/fstab, etc.?

Thanks
h2o
Posts: 40
Joined: 9. Feb 2009, 04:46

Re: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Post by h2o »

Sorry for making everyone wait; heres the next version!
vdfuse50.c
vdfuse v50
(22.34 KiB) Downloaded 1246 times
stefan.becker
Volunteer
Posts: 7639
Joined: 7. Jun 2007, 21:53

Re: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Post by stefan.becker »

Works perfectly. Compile with no errors, mont XP and Windows 7 Images.

That *must* be a Feature of VBOX in the Original Version.
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Re: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Post by TerryE »

Thanks h2o. The attachment idea is far better than relying on me. Sorry. A fantasic job. Well done
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
rainbow.hippie
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

Invalid arguments

Post by rainbow.hippie »

I've compiled vdfuse50.c without errors.
In /etc/fuse.conf, I have uncomment 'user_allow_other'
/dev/fuse has chmod 20666
/mnt/loop/ is rw for any user.

When I try to mount the DVI with following command: vdfuse -t VDI -v -f /media/sda2/VirtualBox/HardDisks/WindowsXP.vdi /mnt/loop/

I receive as error:
. fusermount:
. failed to open /etc/fuse.conf: Permission denied
. fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
Which is strange, since I've uncomment it.

When I try to do this as root, I get error message:
. Partition Size Offset
. ========= ==== ======

. Partition1 32256 10725732864


. fuse: mount failed: Invalid argument

Strange, isn't it?

Furthermore: does some HOWTO exist, where everything is explained?

Thanks for any help.
Last edited by rainbow.hippie on 11. May 2009, 08:14, edited 1 time in total.
h2o
Posts: 40
Joined: 9. Feb 2009, 04:46

Re: Invalid arguments

Post by h2o »

rainbow.hippie wrote: . failed to open /etc/fuse.conf: Permission denied
Check the permissions on /etc/fuse.conf.
rainbow.hippie
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

patch: **** malformed patch at line 16: @@ -104,7 +104,11 @@

Post by rainbow.hippie »

I changed the permissions of /etc/fuse.conf.

Now I can use vdfuse, which gives me two files: EntireDisk and Partition1. I have to use the latter, but then I receive the error:
# mount -o loop /mnt/loop/Partition1 /mnt/iso/ -t ntfs
/mnt/loop/Partition1: No such file or directory

I read on this thread that vdfuse.c has to be patched, but that fails with the error:
patch: **** malformed patch at line 16: @@ -104,7 +104,11 @@ (as allready was mentioned)
I use Kubuntu 8.10 (Linux)

:cry:
rainbow.hippie
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

Re: Discuss: Mount any VBox-compatible disk image on the host

Post by rainbow.hippie »

Yes, vdfuse50.c
TerryE
Volunteer
Posts: 3572
Joined: 28. May 2008, 08:40
Primary OS: Ubuntu other
VBox Version: PUEL
Guest OSses: Ubuntu 10.04 & 11.10, both Svr&Wstn, Debian, CentOS
Contact:

Re: Discuss: Mount any VBox-compatible disk image on the host

Post by TerryE »

The latest version doesn't need patched. If you are mounting the VDI on /mnt/loop then what do you see when you do a
  • ls -l /mt/loop
    file /mnt/loop/Partition1
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
rainbow.hippie
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

Partition1: No such file or directory SOLVED ?

Post by rainbow.hippie »

The problem seems to be solved (more or less).

I've vdfuse'd the VDI to another directory, and now I can mount Partition1.
The directory which fails AND the one which succedes are owned by the user (Ulrich) and have permissions set: dr-xr-xr-- (octal: 40554).
Partition1 in both directories has octal: 10644


ulrich@Phaedon:~$ ls -l /mnt/loop
insgesamt 20960109
-rw-r--r-- 1 ulrich ulrich 10737418240 2009-05-10 23:06 EntireDisk
-rw-r--r-- 1 ulrich ulrich 10725732864 2009-05-10 23:06 Partition1

ulrich@Phaedon:~$ file /mnt/loop/Partition1
/mnt/loop/Partition1: writable, regular file, no read permission

root@Phaedon:~# mount -o loop /mnt/loop/Partition1 /mnt/iso/ -t ntfs
/mnt/loop/Partition1: No such file or directory

Strange and important detail: when I try to open/read Partition1 with MC, I also receive a 'no such file or dierectory'.

Now I've vdfuse'd to /mnt/iso:
ulrich@Phaedon:~$ ls -l /mnt/iso
insgesamt 20960109
-rw-r--r-- 1 ulrich ulrich 10737418240 2009-05-11 12:58 EntireDisk
-rw-r--r-- 1 ulrich ulrich 10725732864 2009-05-11 12:58 Partition1

ulrich@Phaedon:~$ file /mnt/iso/Partition1
/mnt/iso/Partition1: x86 boot sector, Microsoft Windows XP Bootloader NTFS (german) (!!!!!!!!!!!!!!!!???!!!!!!!!!!!!!!!!!!!!!!)
Mounting as loop device works now.

Does vdfuse not like directories that are named 'loop'?
rainbow.hippie
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

Mounting snapshots ?

Post by rainbow.hippie »

Is it also possible to mount snapshots this way?
I have a corrupt virtual machine, and would like to retrieve information that must be stored inside a snapshot.
When I try to do so, I receive as error: ERROR: opening vbox image failed
h2o
Posts: 40
Joined: 9. Feb 2009, 04:46

Re: Discuss: Mount any VBox-compatible disk image on the host

Post by h2o »

Unfortunately this version doesn't support snapshots. I have no idea why because I have no idea what a snapshot is composed of. Maybe Terry would know why...
Post Reply