Show Table of Contents
21.13. virt-diff: Listing the Differences between Virtual Machine Files
virt-diffcommand-line tool can be used to lists the differences between files in two virtual machines disk images. The output shows the changes to a virtual machine's disk images after it has been running. The command can also be used to show the difference between overlays.
You can use
virt-diffsafely on live guest virtual machines, because it only needs read-only access.
This tool finds the differences in file names, file sizes, checksums, extended attributes, file content and more between the running virtual machine and the selected image.
virt-diffcommand does not check the boot loader, unused space between partitions or within file systems, or "hidden" sectors. Therefore, it is recommended that you do not use this as a security or forensics tool.
virt-diff, run one of the following commands:
yum install /usr/bin/virt-diff
yum install libguestfs-tools-c
To specify two guests, you have to use the
-doption for the first guest, and the
-Doption for the second guest. For example:
virt-diff -a old.img -A new.img
You can also use names known to libvirt. For example:
virt-diff -d oldguest -D newguest
The following command options are available to use with
|--help|| Displays a brief help entry about a particular command or about the || |
|-a [file] or --add [file]|| |
Adds the specified file, which should be a disk image from the first virtual machine. If the virtual machine has multiple block devices, you must supply all of them with separate
The format of the disk image is auto-detected. To override this and force a particular format, use the
|-a [URI] or --add [URI]||Adds a remote disk. The URI format is compatible with guestfish. For more information, see Section 21.4.2, “Adding Files with guestfish”.|| |
|--all|| Same as || |
|--atime|| By default, || |
|-A [file]||Adds the specified file or URI, which should be a disk image from the second virtual machine.|| |
|-c [URI] or --connect [URI]|| Connects to the given URI, if using libvirt. If omitted, then it connects to the default libvirt hypervisor. If you specify guest block devices directly (|| |
|--csv||Provides the results in a comma-separated values (CSV) format. This format can be imported easily into databases and spreadsheets. For further information, see Note.||virt-diff --csv|
|-d [guest] or --domain [guest]||Adds all the disks from the specified guest virtual machine as the first guest virtual machine. Domain UUIDs can be used instead of domain names.|| $ |
|-D [guest]||Adds all the disks from the specified guest virtual machine as the second guest virtual machine. Domain UUIDs can be used instead of domain names.|| |
|--extra-stats||Displays extra statistics.|| |
| --format or --format=[|| The default for the || |
|-h or --human-readable||Displays file sizes in human-readable format.|| |
Displays time fields for changed files as days before now (negative if in the future).
|-v or --verbose||Enables verbose messages for debugging purposes.|| |
|-V or --version|| Displays the || |
|-x||Enables tracing of libguestfs API calls.|| |
The comma-separated values (CSV) format can be difficult to parse. Therefore, it is recommended that for shell scripts, you should use csvtool and for other languages, use a CSV processing library (such as Text::CSV for Perl or Python's built-in csv library). In addition, most spreadsheets and databases can import CSV directly.
For more information, including additional options, see libguestfs.org.