Results 1 to 7 of 7

Thread: Mount a Virtual Box .vdi as a logical drive in Ubuntu

  1. #1
    Join Date
    Mar 2008
    Beans
    3

    Question Mount a Virtual Box .vdi as a logical drive in Ubuntu

    Is there any way I could mount a .vdi (with XP installed) as a logical partition? Or infact just veiw the contents of the .vdi and copy them to an empty logical drive that I have and Boot from it (yes I will have to check the boot flag on that partition using GParted or something or repair it with the XP CD but that doesn't take much time compared to installing it fresh and installing all the app's etc on it)
    (I read that something called losetupcan do it but I have no clue how to use it)
    Any help people?
    PS: Ubuntu with Compiz Fusion kicks Vista+OSX butt

  2. #2
    Join Date
    Jan 2006
    Location
    Poland, Warsaw
    Beans
    6
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Mount a Virtual Box .vdi as a logical drive in Ubuntu

    Look at my how-to based on basic shell tools:
    Mounting partition from VDI fixed-size image

    Unfortunately this works only with fixed-size images on little-endian machines.

  3. #3
    Join Date
    May 2007
    Location
    Townsville, Australia
    Beans
    1,820
    Distro
    Lubuntu 14.04 Trusty Tahr

    Re: Mount a Virtual Box .vdi as a logical drive in Ubuntu

    Quote Originally Posted by przemoc View Post
    Look at my how-to based on basic shell tools:
    Mounting partition from VDI fixed-size image

    Unfortunately this works only with fixed-size images on little-endian machines.

    i hate to sound stupid, but what is a little-endian???
    where do you get it??
    Ubuntu user # 16304 www.nocleanfeed.com
    If someone asks you to sudo rm -rf anything, don't do it, and don't run any command with rm in it unless you know exactly what you're doing.things i have learnt changing from Xp pro to Ubuntu

  4. #4
    Join Date
    Jan 2006
    Location
    Poland, Warsaw
    Beans
    6
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Mount a Virtual Box .vdi as a logical drive in Ubuntu

    Quote Originally Posted by stinger30au View Post
    i hate to sound stupid, but what is a little-endian???
    Long answer: http://en.wikipedia.org/wiki/Endianness.
    Short answer (part from wikipedia): Well known processor architectures that use the little-endian format include x86, 6502, Z80, VAX, and, largely, PDP-11.

    So anyone with x86 or x86_64 CPU has little-endian machine. VirtualBox currently doesn't support any other architectures, but linux works also on big-endian machines and that is why I made a comment about endianness.

  5. #5
    Join Date
    Dec 2008
    Beans
    3

    Re: Mount a Virtual Box .vdi as a logical drive in Ubuntu


  6. #6
    Join Date
    Apr 2007
    Location
    europe
    Beans
    74
    Distro
    Ubuntu

    Re: Mount a Virtual Box .vdi as a logical drive in Ubuntu

    yes, i do know this thread is somewhat old, nevertheless i came across this multiple times during my search for a possibility to directly access a virtualbox .vdi .

    after quite some browsing and reading i came across this very helpful blogentry by jeff waugh describing the following solution that takes advantage of the nbd (network block device) kernel module + qemu-nbd:

    - make sure you have qemu-nbd available (can be found in the qemu-kvm package)
    - load the nbd module through ' sudo modprobe nbd '
    - let qemu-nbd provide a loopback block device for the vdi ' sudo qemu-nbd -c /dev/nbd0 <vdi-file> ' and find your .vdi in the device /dev/nbd0 and its partitions in /dev/nbd0p1, /dev/nbd0p2 and so on.
    - mount your desired partition(s) or do whatever you want with these devices (format, change partitions...)
    - when done, remove the blockdevices (after unmounting etc) through ' sudo qemu-nbd -d /dev/nbd0 '.

    the original author states that this also works with both, static and dynamically sized .vdi images but so far i only tried static ones which worked just fine!

    many thanks to the original author jeff!


    edit:
    just in case virtualbox refuses to run a vm after you went through the previously described scenario with an error mentioning something like 'VirtualBox can't enable the AMD-V extension. Please disable the KVM kernel extension, recompile your kernel and reboot' it might be necessary to unload the kvm-modules bei either issuing ' sudo rmmod kvm-intel ' or ' sudo rmmod kvm-amd '. you can use ' sudo lsmod ' to see which modules are currently loaded.

    enjoy,
    antiplex
    Last edited by antiplex; June 23rd, 2011 at 05:13 PM.

  7. #7
    Join Date
    Jan 2008
    Beans
    7

    Re: Mount a Virtual Box .vdi as a logical drive in Ubuntu

    Thank you for this, but it doesn't work for me. When running qemu-nbd -c /dev/nbd0 /image.vdi I get an error (originating from the ndb.c module): "Failed setting NBD block size".

    Any suggestions?

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •