Tip: List all files in a virtual machine

Note: This requires libguestfs 1.5.x or the libguestfs 1.4.3 + backports that we are shipping in Fedora 13 updates testing.

Quick tip: list all the files in a VM:

$ guestfish --ro -a disk.img -i find0 / - | tr '\000' '\n' | sort | less

Explanation:

  1. guestfish --ro -a disk.img -i is the new style way to inspect a disk image using guestfish. For a libvirt domain, use guestfish --ro -d GuestName -i instead.
  2. find0 / - lists all the files to stdout.
  3. The filenames are separated by ASCII NUL character, tr '\000' '\n' translates that to newlines.
  4. sort | less sorts and pages the output.

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.