Page 6 of 13

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

Posted: 12. May 2009, 05:24
by h2o
I'm changed this to a discussion topic, and the original HOWTO has been moved to another topic. See the first post of this topic to see the new home of the howto :-)

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

Posted: 11. Jun 2009, 10:05
by TerryE
es1 wrote:Thanks for great VDI tutorial. I downloaded the vdfuse-v50.c and it failed on the mount with 'invalid argument'. I used Fedora 11 and I ran it as super user. Other fuse FS were working fine. Do you have and experience with such failure? Do you have a new version of vdfuse.c ?
Not sure about this one. I do all my testing on Ubuntu and I tried it on other Debian builds. I am not too familiar with the Redhat Dirstros. Fedora 11 is new, and maybe there is a subtle API change. All I can suggest is that do a debug build and run it under Gdb to see. No I don't have. Sorry. h2o and I developed this largely for our own use but shared it with the community because is can be really useful.
es1 wrote: What are the pros/cons of this program compared with the nbd based mount utility?
Mainly performance and mainstream. This uses a fuse API, and FUSE filesystems are reasonably efficient. Nbd works through the network stack.

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

Posted: 12. Jun 2009, 23:18
by es1
Hi Terry, VBox team,

On Fedora I get error with vdfuse-v50.c due to empty dummy device name, I changed it to "vdi" and it works.

Here is the patch (also fixed the warning generated if compiled with -Wshadow)

Code: Select all

# diff -u vdfuse-v50.c vdfuse-v50a.c 
--- vdfuse-v50.c	2009-06-12 16:30:40.093827292 -0400
+++ vdfuse-v50a.c	2009-06-12 17:11:58.113828315 -0400
@@ -254,7 +254,7 @@
    myuid = geteuid ();
    mygid = getegid ();
 
-   fuse_opt_add_arg (&fuseArgs, "");
+   fuse_opt_add_arg (&fuseArgs, "vdi");
    fuse_opt_add_arg (&fuseArgs, "-o");
    fuse_opt_add_arg (&fuseArgs, allowall ? "allow_other": "allow_root");
    if (foreground) fuse_opt_add_arg (&fuseArgs, "-f");
@@ -529,8 +529,8 @@
    filler (buf, ".", NULL, 0);
    filler (buf, "..", NULL, 0);
    for (n = 0; n <= lastPartition; n++) {
-      Partition *p = partitionTable + n;
-      if (p->no != UNALLOCATED) filler(buf, p->name, NULL, 0);
+      Partition *pr = partitionTable + n;
+      if (pr->no != UNALLOCATED) filler(buf, pr->name, NULL, 0);
    }
    return 0;
 }
btw: I get these warnings if compiled with '-W -Wall' (which is different from only -Wall)

Code: Select all

In file included from vdtest.c:115:
/home/es1/virtualbox/VirtualBox-2.2.4_OSE/include/VBox/VBoxHDD.h: In function ‘VDInterfaceGet’:
/home/es1/virtualbox/VirtualBox-2.2.4_OSE/include/VBox/VBoxHDD.h:275: warning: comparison of unsigned expression >= 0 is always true
/home/es1/virtualbox/VirtualBox-2.2.4_OSE/include/VBox/VBoxHDD.h: In function ‘VDInterfaceAdd’:
/home/es1/virtualbox/VirtualBox-2.2.4_OSE/include/VBox/VBoxHDD.h:311: warning: comparison of unsigned expression >= 0 is always true

HTH 8)

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

Posted: 19. Jun 2009, 22:48
by csavery
Hello,
I'm trying to build this vdfuse tool as described in the HOW TO.
It says you can use svn to get the headers without needing all the source. I did this.

When I try to run the vdbuild script it gives me the message:
.: 32: Can't open /etc/vbox/vbox.cfg

I don't have that file and don't know where it's supposed to come from. In /etc/vbox all I have is a file called "interfaces".

My current installed version is 2.2.2 but I see 2.2.4 is out now. I haven't updated yet. Do I need to or is there some other reason I don't have this vbox.cfg file present?

I want to try this out to mount a vdi I have without starting a machine just to access the files.
Thanks for your help.
Chris :)

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

Posted: 19. Jun 2009, 23:16
by es1
Just comment out the exit statement in the build script, and add the following line
INSTALL_DIR=/usr/lib/virtualbox


8)

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

Posted: 20. Jun 2009, 00:53
by csavery
Thank you. That worked.
Also had to apt-get install libfuse-dev, but no problem there.
Chris :)

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

Posted: 20. Jun 2009, 01:18
by csavery
Oops. Spoke too soon.
I compiled and have a binary but it always just gives me an error message when I try to use it.

sudo vdfuse -f .VirtualBox/HardDisks/Jeos.vdi /mnt/vdi
fuse: mount failed: Invalid argument

If I add -v (verbose) then it tells me the file type is VDI and see partitions as expected but same msg out.

Tried again and again,always same. Except if I run non-sudo it tells me mount point is not writeable by user.
Any ideas?
Thanks,
Chris :)

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

Posted: 20. Jun 2009, 01:22
by baf
Guessing:
Create a directory in your home directory then mount it to that without any sudo.
Or change ownership of /mnt/vdi to your user (still no sudo) .

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

Posted: 20. Jun 2009, 04:29
by TerryE
Have set up your /etc/fuse.conf?

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

Posted: 20. Jun 2009, 05:49
by csavery
I've only done what was indicated in the HOWTO.
It doesn't say anything about fuse.conf as far as I recall.
I do use the sshfs tools though and I believe it also uses fuse to work, so maybe there is some conflict?
SSHFS works fine with when my vbox guest is running and allows me to mount part of the guest filesystem into my host so that I can use development editor tools easily.
Chris :)

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

Posted: 20. Jun 2009, 15:00
by es1
Chris,

What linux distribution are you using?
Did you apply the patch from the previous post:

- fuse_opt_add_arg (&fuseArgs, "");
+ fuse_opt_add_arg (&fuseArgs, "vdi");

Change the first fuse_opt_add_arg() from empty string to "vdi" or "vdisk" on some distros it is required (Fedora for example).

Good Luck 8)

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

Posted: 20. Jun 2009, 18:34
by csavery
Ubuntu 8.10
I haven't applied any patch - as I said just followed the HOWTO instructions.
Maybe It's not much of a HOWTO if it leaves out a bunch of stuff that people need to do.
It gives me that message about command args but the only command line arg I gave was "-f vdifile".
I looked at my /etc/fuse.conf and it has only (below) what appears to be comments.

# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000

# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#
#user_allow_other

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

Posted: 20. Jun 2009, 18:40
by csavery
I tried making a mnt directory in my home and mounting there.
I get,
fusermount: option allow_other only allowed if 'user_allow_other' is set in /etc/fuse.conf
But huh? In this case the mnt directory is owned by me and the VDI file is owned by me so what other user is involved here?
My command was simply,
vdfuse -f .VirtualBox/HardDisks/Jeos.vdi mnt
Done in my home directory.
It seems like something is not setup right with fuse - still, I have been using it fine with SSHFS for over a year and never had these kind of nonsensical messages.
Oh well, just thought I could improve things a little by not having to start the VM just to get some info from a file on it.

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

Posted: 21. Jun 2009, 12:17
by TerryE
Chris, this isn't part of the core product. It was developed by a couple of VB users for their own purposes and shared with the community just in case anyone else found it useful. You are right in that before something like this was made available to the average user then we'd need to "productionise" properly. There are subtleties of the access rights around FUSE modules that we need to bottom first. However, at the moment you are giving me a hard time for not putting in a lot of hours improving something that I have contributed — so that you don't need to bother reading a manual. I know that h2o or I (or someone else such as es1) could improve this, but its a Q of priorities. I am in the middle of upgrading a bunch of forums that I help support to the latest version of phpBB. I am also working with the phpBB dev team to put in some tuning improvements. I'll get around to this when I have time, if one of the others doesn't do it first. This is how these little FLOSS goodies work.

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

Posted: 21. Jun 2009, 15:50
by es1
Chris,
First I give you the answers then ...

looking into the code of vdfuse and applying the patch I mentioned, if you need only a user to have access, without others accessing the data, then you may try to comment out two lines:

lines 232,233:
// fuse_opt_add_arg (&fuseArgs, "-o");
// fuse_opt_add_arg (&fuseArgs, allowall ? "allow_other": "allow_root");

This will eliminate the request for allow others. and you should be OK, I did not test it, please do and let us all know if it works for you.

Now to the approach issue:
You and I are using free software, we should thank for whatever it is - and mostly it is great product, flexible with many features. If it doesn't have the documentation or feature, we should read more, even dive into source code if needed, and write and contribute back. I'll take your complain as a "wish list" of what you would like to have as documentation and features of the products (remember that vdfuse is not part of any product, just good contributed code for the community).

HTH
Best,
8)