You are not logged in.

#1 2015-12-18 17:55:09

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

[SOLVED] How to extract a .vdi file?

Does anyone know how to extract a .vdi file?

Last edited by earlybird (2016-01-04 08:54:21)

Offline

#2 2015-12-18 20:02:29

gako
Member
Registered: 2015-10-02
Posts: 241

Re: [SOLVED] How to extract a .vdi file?

There was an old tool called "vditool" - which had a DUMP option.
You could get the offset of the .vdi disk data and mount -o loop it.

There is no vditool anymore and I think Virtualbox replaced functionality with VBoxManage (comes with virtualbox)
Not sure how to use the same way, and even if you could, the .vdi would probably have to be "fixed" size rather than "dynamic",

I attempted on one of my dynamic .vdi

/srv/vbox-vms  ■: sudo VBoxManage clonehd --format RAW name.vdi name.img 

0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Failed to clone hard disk
VBoxManage: error: Could not create the clone medium '/srv/vbox-vms/Bunsenlabs-Hydrogen-rc1-amd64/Bunsenlabs-Hydrogen-rc1-amd64.img'.
VBoxManage: error: Raw: disk would overflow creating image '/srv/vbox-vms/Bunsenlabs-Hydrogen-rc1-amd64/Bunsenlabs-Hydrogen-rc1-amd64.img' (VERR_DISK_FULL)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component Medium, interface IMedium
VBoxManage: error: Context: "int handleCloneHardDisk(HandlerArg*)" at line 745 of file VBoxManageDisk.cpp

maybe my approach is misguided though hmm

Ah but there is  virtualbox-fuse / vdfuse (dropped from jessie sad)

Offline

#3 2015-12-18 21:43:16

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: [SOLVED] How to extract a .vdi file?

I tried with qemu-nbd, but didn't work either. There is a how-to here, http://jsmylinux.no-ip.org/virtualbox/e … rom-a-vdi/ but didn't work for me. I don't want to install Windows on my hard disk, but I have it in Virtualbox. I don't know how to copy files from running VM to a partition. So, trying to find a way to extract the whole vdi file.

Offline

#4 2015-12-18 21:57:19

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: [SOLVED] How to extract a .vdi file?

ostrolek wrote:

I don't know how to copy files from running VM to a partition

Can you not just enable shared folders?
https://wiki.archlinux.org/index.php/Vi … ed_folders


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#5 2015-12-19 12:23:13

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: [SOLVED] How to extract a .vdi file?

^ Thanks, HoaS, I'd try that. Now, I have another question; how do you link to an exact place in the web page, as you did in the above link to "Enable shared folders?"

Offline

#6 2015-12-19 12:28:27

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: [SOLVED] How to extract a .vdi file?

ostrolek wrote:

how do you link to an exact place in the web page, as you did in the above link to "Enable shared folders?"

The ArchWiki has URL subheaders on every page -- simply click on them in the "Contents" section then copy&paste the address bar wink


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#7 2015-12-19 13:22:15

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: [SOLVED] How to extract a .vdi file?

^ What I meant was how to link a place in the middle of the web page, any web page.

Offline

#8 2015-12-19 13:25:15

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 8,759
Website

Re: [SOLVED] How to extract a .vdi file?

That would depend on whether a subheader URL was available for that section of the page.

I don't know how to link to an arbitrary position in a web page, if that's what you mean.

Of course it may be possible, I'm fairly ignorant of such matters.


“Et ignotas animum dimittit in artes.” — Ovid, Metamorphoses, VIII., 18.

Forum Rules   •   How to report a problem   •   Software that rocks

Offline

#9 2015-12-19 13:34:14

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,482

Re: [SOLVED] How to extract a .vdi file?

ostrolek wrote:

Does anyone know how to extract a .vdi file?

Convert the .vdi image into the QEMU .qcow2 image format using

qemu-img convert [...]

then mount the resulting .qcow2 image as a network block device using qemu-nbd, for example described here.

This will expose the partitions inside the image as regular block devices in /dev:

 $ ls -l /dev/nbd0*
brw-rw---- 1 root disk 43, 0 Dec  6 23:03 /dev/nbd0
brw-rw---- 1 root disk 43, 1 Dec  6 23:03 /dev/nbd0p1
brw-rw---- 1 root disk 43, 2 Dec  6 23:03 /dev/nbd0p2

(accidentally, I have got a mounted qcow2 image right here!), which you then can just mount using the mount command.


A silent kite against the blue, blue sky

Offline

#10 2015-12-19 16:40:00

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: [SOLVED] How to extract a .vdi file?

^ Thanks! I'd have a look.
EDIT: Tried it, but the vdi file is too large. It won't go more than 4.3GB, even if I had created the qume img for 10GB. Maybe, I'd have to reinstall Win10 in qemu, then try to open it in parts, or try to install Win10 on a large USB stick, and then copy the files from that. What I want to try is to install Win10 manually, without letting it take over the computer. Right now, this Windows10 is run in VM on Debian Sid as host--used as a secondary distro. If Windows has to be dual booted with a Linux distro, the Linux should be the first distro, not take the 2nd place.

Last edited by nobody0 (2015-12-19 18:07:00)

Offline

#11 2015-12-20 04:03:35

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,482

Re: [SOLVED] How to extract a .vdi file?

ostrolek wrote:

^ Thanks! I'd have a look.
EDIT: Tried it, but the vdi file is too large. It won't go more than 4.3GB, even if I had created the qume img for 10GB. Maybe, I'd have to reinstall Win10 in qemu, then try to open it in parts, or try to install Win10 on a large USB stick, and then copy the files from that. What I want to try is to install Win10 manually, without letting it take over the computer. Right now, this Windows10 is run in VM on Debian Sid as host--used as a secondary distro. If Windows has to be dual booted with a Linux distro, the Linux should be the first distro, not take the 2nd place.

On what file system are you trying to perform the operation? Use a file system native to Linux, at least ext3. If you were trying to this on a FAT32 partition: this format's maximum file size is 4G.


A silent kite against the blue, blue sky

Offline

#12 2015-12-20 09:03:57

nobody0
Disabled account
Registered: 2015-09-29
Posts: 664

Re: [SOLVED] How to extract a .vdi file?

^ Thanks.
I was trying to do that in a fat32 partition, as it had lot of free space. Moved to a Linux partition and it worked. Now, I have to find at least 16gb usb stick to burn the raw file (12.8GB) into it. Hope, it'd boot later, or at least I could get at the directories there.

Offline

#13 2015-12-20 09:53:49

twoion
ほやほや
Registered: 2015-08-10
Posts: 2,482

Re: [SOLVED] How to extract a .vdi file?

ostrolek wrote:

^ Thanks.
I was trying to do that in a fat32 partition, as it had lot of free space. Moved to a Linux partition and it worked. Now, I have to find at least 16gb usb stick to burn the raw file (12.8GB) into it. Hope, it'd boot later, or at least I could get at the directories there.

As I have suggested before, you can mount the partitions in the qcow2 image via qemu-nbd+mount and just browse the files in the file system.


A silent kite against the blue, blue sky

Offline

#14 2015-12-22 02:21:32

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 5,713
Website

Re: [SOLVED] How to extract a .vdi file?

<OffTopicButOfPossibleGeneralInterest>

ostrolek wrote:

^ What I meant was how to link a place in the middle of the web page, any web page.

You have to open the web page's source and look for a tag with an "id" attribute. For example, that section of the Arch Wiki looks like this

<h3><span class="mw-headline" id="Enable_shared_folders">Enable shared folders</span></h3>
<p>Shared folders are managed...

Now add that ID after a hashmark to the page's URL, like: ...archlinux.org/index.php/VirtualBox#Enable_shared_folders

If there's no tag with an id you're out of luck.

</OffTopicButOfPossibleGeneralInterest>

Last edited by johnraff (2015-12-25 06:53:29)


John
--------------------
( a boring Japan blog , Japan Links, idle twitterings  and GitStuff )
In case you forget, the rules.

Offline

#15 2016-01-03 15:13:31

Eon
Member
From: Mumbai, IN
Registered: 2015-09-29
Posts: 69

Re: [SOLVED] How to extract a .vdi file?

@twoion
thank you for providing the solution. I was searching for this kind of solution from months iirc. It is greatly helpful.
+1 to 2ion. smile

Last edited by Eon (2016-01-03 16:52:39)

Offline

Board footer

Powered by FluxBB