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

Discussions related to using VirtualBox on Linux hosts.
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

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

Post by NeBlackCat »

NeBlackCat wrote:Anyone know if it's possible to copy the vdfuse program from an OSE installation to a PUEL one, and use it to mount VHDs?
To answer my own question, yes it is. You just extract the single vdfuse executable from its distribution package (eg. virtualbox-ose-fuse.deb on Debian derivatives) into somewhere on the path of your PUEL system . It just seems to use VirtualBox's VBoxDDU.so library, which seems the same on both PUEL and OSE (as far as vdfuse is concerned anyway).

But I'm finding vlosetup (with its vloop.ko driver) from the VBoot project to be a far superior tool for mounting/manipulating virtual and raw disk image files independently of (or together with) VirtualBox.

Anyone else using that?
tobermory
Posts: 7
Joined: 30. Mar 2011, 20:36
Primary OS: Ubuntu 8.04
VBox Version: OSE other
Guest OSses: windows linux

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

Post by tobermory »

Can you expand on your use of vlosetup? I am looking to use vdfuse as a way of traversing/acquiring the 'dd image' inside a .vdi file. What makes vdfuse great is that Snapshot merges are transparent to the user. Can VBoot offer similar functionality?
NeBlackCat
Posts: 154
Joined: 3. Aug 2008, 13:37

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

Post by NeBlackCat »

afaik vlosetup also supports snapshotted virtual disks, ie. you pass the snapshot and parent filenames together on the command line and get the whole thing. I haven't used that myself though. I don't think it can read .vbox files to automatically find parents if you only specify the child.

I just wanted a way to mount virtual and raw disk images in Linux, such that they worked like physical disks in all respects, including with the GUI disk management tools like Gnome Disk Utility and GParted (couldn't get vdfuse-mounted ones to do that).

What I liked about it was that the GUI tools work, it handles loop/partition mounting automatically, it can also create/resize virtual disks, it supports raw images (partition and full disk) as well as VDI/VHD/VMDK, and doesn't require VirtualBox to be installed for any of that.

So I can now standardise on VHD files as my imaging format of choice, and have the tools to manipulate them (including differenced images) on both Linux and Windows 7/Server hosts, as well as being able to boot into them on both physical (with VBoot and/or Windows 7) and virtual (with VirtualBox) machines. That is a first!

On the downside, the versions of kernels currently supported are limited. However the next version will apparently work in FUSE mode too. That is, if you have a supported kernel it works inside of it, otherwise it works in FUSE mode.

It seems to be mix of code from losetup, kpartx, vboxmanage, and virtualbox itself, all wrapped up into one. IIRC they're also planning to add more disk image related functionality from vboxmanage (eg. convertfromraw), and support encrypted images (within Truecrypt containers).

Here is the help:

Code: Select all

> vlosetup -h

Usage:
 vlosetup loop_device                             give info
 vlosetup -a | --all                              list all used
 vlosetup -d | --detach <loopdev> [<loopdev> ...] delete
 vlosetup -f | --find                             find unused
 vlosetup -c | --set-capacity <loopdev>           resize
 vlosetup -j | --associated <file> [-o <num>]     list all asso'ed with <file>

 vlosetup --createhd <filename>.vhd|.vdi|.vmdk --sizemeg <num of megabytes>
  create a new virtual diskfile of given megabytes, without setup to loopdev

 vlosetup --creatediff <diff_filename> <parent_filename> [<parent1_filename> <parent2_filename> ...] 
  create a differencing disk file to a base image or another differencing disk.

 vlosetup [ options ] {-f|--find|loopdev} <file>  setup a loopdev with file

Options:
 -h | --help              this help
 -o | --offset <num>      start at offset <num> into file
      --sizelimit <num>   loop limited to only <num> bytes of the file
 -p | --pass-fd <num>     read passphrase from file descriptor <num>
 -r | --read-only         setup read-only loop device
      --show              print device name (with -f <file>)
 -i | --immutable         mount disk as immutable, changes are discarded
 -v | --verbose           verbose mode
kihjin
Posts: 71
Joined: 18. Nov 2008, 21:30
Primary OS: Ubuntu other
VBox Version: OSE self-compiled
Guest OSses: Ubuntu, Windows XP

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

Post by kihjin »

Kind of surprised that no one has noticed this, but vdfuse no longer works for 4.0.8 OSE AND it cannot be built. The VBoxHDD.h header file is gone, "vd.h" needs to be used instead. The VDCreate function takes another parameter, the VDTYPE, which you can use VDTYPE_HDD:

Line 267 Before: if (RT_FAILURE(VDCreate(&vdError, &hdDisk)))

Line 267 After: if (RT_FAILURE(VDCreate(&vdError, VDTYPE_HDD, &hdDisk)))
fixedwheel
Volunteer
Posts: 1699
Joined: 13. Sep 2008, 02:18

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

Post by fixedwheel »

kihjin wrote:Kind of surprised that no one has noticed this, but vdfuse no longer works for 4.0.8 OSE AND it cannot be built. (...)
JFTR ...
http://packages.debian.org/virtualbox-fuse
http://packages.ubuntu.com/virtualbox-fuse
StarNamer
Posts: 5
Joined: 30. Mar 2008, 01:52

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

Post by StarNamer »

As far as I can see, the vloop code from VMLite is not Open Source. In any event, they don't seem to have the source available for download and simply provide versions for Ubuntu (unless I just haven't found it).

Does an Open Source version exist? If so, where can I get it?

I've been mounting VHD disks under Windows 7 for some time when needing to fix/extract something and would like to be able to do the same thing under Linux (with all supported formats). I don't need/want the vboot capability, just the vloop driver. If an Open Source version doesn't exist, I may start looking as hacking something together... :)
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

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

Post by ChipMcK »

StarNamer wrote:Does an Open Source version exist? If so, where can I get it?
refer to vdfuse

Best
Emile
Posts: 12
Joined: 8. Nov 2013, 23:33

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

Post by Emile »

virtualbox-fuse has been removed from Debian testing/jessie. I asked the Debian package maintainer, it won't come back.
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

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

Post by ChipMcK »

in the OSX Host forum, check out vdfuse.

The information may be of use.

Best
Begun
Posts: 1
Joined: 24. Nov 2014, 08:04

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

Post by Begun »

subscribe
ChipMcK
Volunteer
Posts: 1095
Joined: 20. May 2009, 02:17
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Windows, OSX
Location: U S of A

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

Post by ChipMcK »

Begun wrote:subscribe
refer to Virtual Disk Mounting tools
Best
DdB
Posts: 114
Joined: 22. May 2010, 23:27
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: many
Location: Germany

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

Post by DdB »

Wow!
I know, this thread is outdated by now, but it was an interesting read anyway.

If i was to solve a similar problem today, i would definitely not use tools, that have limitations (like the one restricted to primary partitions). Instead, i am using vboxes own code from the host via ssh -> guest, where i just attach and mount any vdi or snapshot thereof. Advantage: It is easy to play with this, snapshot, integrate, write to or read from anything, even filesystems, only the guest knows about (like zfs or such).

Still, i can sense some theoretical advantage to the use of compiled code, but it left me smiling to think of all the corner cases, that would not be handled properly.
And if space permits, even an entire copy of the logical contents of a VDI can easily be created as a readonly compressed image, which can in turn be mounted as a loop device, even separating partitions, that arent primary on the way.

Just saying: There are alternative solutions.
Locked