using vbox-img with pipe (like stdin/stdout)

This is for discussing general topics about how to use VirtualBox.
Post Reply
steve zhang
Posts: 3
Joined: 10. Jan 2020, 18:43

using vbox-img with pipe (like stdin/stdout)

Post by steve zhang »

Hi,

Is it possible to use vbox-img with pipe? like stdin/stdout.

I tried to use with pipe but seemed not working, hopefully some experts can confirm it works with pipe or not.

Thanks,
Steve
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: using vbox-img with pipe (like stdin/stdout)

Post by scottgus1 »

Searching the PDF of the 6.0.14 and 6.1.0 manuals reveals no hits for the text "vbox-img".

In both versions' manuals there is a reference to "vboximg-mount", for "FUSE-mounting" a VDI on Mac or Linux hosts.

Please clarify the exact term for what you are trying to do.

And, lest this be an "XY problem", please first state exactly what you are trying to do without using any special terms, Virtualbox or otherwise. Then we can get a better handle on how to guide you.
steve zhang
Posts: 3
Joined: 10. Jan 2020, 18:43

Re: using vbox-img with pipe (like stdin/stdout)

Post by steve zhang »

Hi,

Sorry if my question is not clear. I will re-state the problem as below:

The vbox-img is a disk utility tool provided by virtualbox as below. One of its features is to provide the format conversion between different formats like vdi or vmdk. From its help information, it seems can accept streaming input/output (--stdin --stdout); however I tried to convert one VDI format to the stdout, it failed. I searched this forum and found similar question 4 years ago at viewtopic.php?f=1&t=74862. I am asking whether any update on this issue. Thanks!

conversion failed output
====================
$vbox-img convert --srcformat VDI --srcfilename OS8.8VirtualBox-disk007.vdi --dstformat VMDK --stdout
Converting image "OS8.8VirtualBox-disk007.vdi" with size 5368709120 bytes (5120MB)...
vbox-img: error: VMDK: could not create new file './VirtualBoxStream.vmdk'

vbox-img help information
=====
$vbox-img help
Oracle VM VirtualBox Disk Utility 6.0.14
(C) 2005-2019 Oracle Corporation
All rights reserved.

Usage: vbox-img
setuuid --filename <filename>
[--format VDI|VMDK|VHD|...]
[--uuid <uuid>]
[--parentuuid <uuid>]
[--zeroparentuuid]

geometry --filename <filename>
[--format VDI|VMDK|VHD|...]
[--clearchs]
[--cylinders <number>]
[--heads <number>]
[--sectors <number>]

convert --srcfilename <filename>
--dstfilename <filename>
[--stdin]|[--stdout]
[--srcformat VDI|VMDK|VHD|RAW|..]
[--dstformat VDI|VMDK|VHD|RAW|..]
[--variant Standard,Fixed,Split2G,Stream,ESX]

info --filename <filename>

compact --filename <filename>
[--filesystemaware]

createcache --filename <filename>
--size <cache size>

createbase --filename <filename>
--size <size in bytes>
[--format VDI|VMDK|VHD] (default: VDI)
[--variant Standard,Fixed,Split2G,Stream,ESX]
[--dataalignment <alignment in bytes>]

createfloppy --filename <filename>
[--size <size in bytes>]
[--root-dir-entries <value>]
[--sector-size <bytes>]
[--heads <value>]
[--sectors-per-track <count>]
[--media-byte <byte>]

createiso [too-many-options]

repair --filename <filename>
[--dry-run]
[--format VDI|VMDK|VHD] (default: autodetect)

clearcomment --filename <filename>

resize --filename <filename>
--size <new size>
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: using vbox-img with pipe (like stdin/stdout)

Post by scottgus1 »

OK, I remember finding that tool in an earlier discussion, it's in the Virtualbox installation folder.
According to this: VirtualBox 4.1 released 'vbox-img.exe' is a "standalone image manipulation tool".

Googling "vbox-img.exe" site:forums.virtualbox.org shows that this tool doesn't come up much, and there appears to be no references to how to successfully use 'stdin' or 'stdout' successfully.

This is part of the "help" output of vbox-img.exe:
convert         --srcfilename <filename>
                --dstfilename <filename>
                [--stdin]|[--stdout]
                [--srcformat VDI|VMDK|VHD|RAW|..]
                [--dstformat VDI|VMDK|VHD|RAW|..]
                [--variant Standard,Fixed,Split2G,Stream,ESX]
Typical formatting in these command-line switch lists is that items in []'s are optional, items not in []'s are mandatory. What I see in this is that there must be a "--srcfilename <filename>" and a "--dstfilename <filename>". Your command is missing the "--dstfilename <filename>". There does not seem to be a way to pass the source disk contents to stdout, if that is what you're trying to do.

Just out of curiosity, from an XY standpoint, what are you trying to do?
steve zhang
Posts: 3
Joined: 10. Jan 2020, 18:43

Re: using vbox-img with pipe (like stdin/stdout)

Post by steve zhang »

Yes, I agree it seems not too much information to do the conversion through pipe. For your question, I tried to use pipe to do the conversion on the fly and do not want to save the file to the disk.

Thanks,
Steve
Post Reply