Richard W.M. Jones: Tip: Run virt-inspector on a compressed disk (with nbdkit)

virt-inspector is a very convenient tool to examine a disk image and find out if it contains an operating system, what applications are installed and so on.

If you have an xz-compressed disk image, you can run virt-inspector on it without uncompressing it, using the magic of captive nbdkit. Here’s how:

nbdkit xz file=win7.img.xz 
    -U - 
    --run 'virt-inspector --format=raw -a nbd://?socket=$unixsocket'

What’s happening here is we run nbdkit with the xz plugin, and tell it to serve NBD over a randomly named Unix domain socket (-U -).

We then run virt-inspector as a sub-process. This is called “captive nbdkit”. (Nbdkit is “captive” here, because it will exit as soon as virt-inspector exits, so there’s no need to clean anything up.)

The $unixsocket variable expands to the name of the randomly generated Unix domain socket, forming a libguestfs NBD URL which allows virt-inspector to examine the raw uncompressed data exported by nbdkit.

The nbdkit xz plugin only uncompresses those blocks of the data which are actually accessed, so this is quite efficient.


Source From: fedoraplanet.org.
Original article title: Richard W.M. Jones: Tip: Run virt-inspector on a compressed disk (with nbdkit).
This full article can be read at: Richard W.M. Jones: Tip: Run virt-inspector on a compressed disk (with nbdkit).

Advertisement
StudioPress Premium WordPress Themes: Foodie Pro Theme


Random Article You May Like

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*