Tag Archives: unix pipes

Tip: In guestfish, extract files from disk image to a local directory

You’ve loaded your filesystem in guestfish, how do you extract all the files into the local directory on the host? Easy …

><fs> tgz-out / - | tar zxf -

This is a little bit subtle. Here’s how it works:

On the left hand side of the pipe, we run the guestfish “tgz-out” command which turns / into a tarball and sends it to “-” (stdout).

On the right hand side of the pipe is a host command, tar, which unpacks stdin into the local directory. (This explains how pipes work in guestfish)

N.B.: An alternative, for VM images, is to use the higher-level virt-tar command.

Leave a comment

Filed under Uncategorized