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

Discussions related to using VirtualBox on Linux hosts.

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

Postby TerryE » 26. Apr 2009, 06:30

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.
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

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

Postby rainbow.hippie » 27. Apr 2009, 23:24

h2o wrote:Update 2/12/09: Use this, it's better http://forums.virtualbox.org/viewtopic.php?p=59678#59678
1) Get the package nbd:
On Ubuntu:
Code: Select all   Expand viewCollapse view
apt-get install nbd-client

2) Compile it
Download it, compile it with:
Code: Select all   Expand viewCollapse view
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
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

Postby mlafauci » 29. Apr 2009, 10:58

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

Thanks
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

Postby h2o » 10. May 2009, 03:15

Sorry for making everyone wait; heres the next version!

vdfuse50.c
vdfuse v50
(22.34 KiB) Downloaded 1232 times
h2o
 
Posts: 40
Joined: 9. Feb 2009, 04:46

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

Postby stefan.becker » 10. May 2009, 11:56

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

That *must* be a Feature of VBOX in the Original Version.
stefan.becker
Volunteer
 
Posts: 7612
Joined: 7. Jun 2007, 21:53

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

Postby TerryE » 10. May 2009, 13:44

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.
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

Invalid arguments

Postby rainbow.hippie » 10. May 2009, 14:16

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.
rainbow.hippie
 
Posts: 8
Joined: 27. Apr 2009, 19:50
Primary OS: Ubuntu 8.10
VBox Version: PUEL
Guest OSses: WindowsXP

Re: Invalid arguments

Postby h2o » 10. May 2009, 20:36

rainbow.hippie wrote:. failed to open /etc/fuse.conf: Permission denied


Check the permissions on /etc/fuse.conf.
h2o
 
Posts: 40
Joined: 9. Feb 2009, 04:46

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

Postby rainbow.hippie » 10. May 2009, 21:15

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: (Loop) mount any VBox disk type (VDI,VMDK,VHD) on Host

Postby h2o » 11. May 2009, 00:01

Did you use this version? viewtopic.php?p=75225#p75225
h2o
 
Posts: 40
Joined: 9. Feb 2009, 04:46

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

Postby rainbow.hippie » 11. May 2009, 08:13

Yes, vdfuse50.c
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

Postby TerryE » 11. May 2009, 11:37

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.
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

Partition1: No such file or directory SOLVED ?

Postby rainbow.hippie » 11. May 2009, 13:16

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 ?

Postby rainbow.hippie » 11. May 2009, 13:49

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
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

Postby h2o » 12. May 2009, 05:20

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...
h2o
 
Posts: 40
Joined: 9. Feb 2009, 04:46

PreviousNext

Return to VirtualBox on Linux Hosts

Who is online

Users browsing this forum: No registered users and 16 guests