On Tue, May 22, 2012 at 08:01:50PM +0800, Wanlong Gao wrote:
So, you means we can use virt-ls to list the different files list,
and then
use virt-cat to see the different between two single files?
Yes, this is what I usually do.
For example:
$ qemu-img create -f qcow2 -b /dev/vg_pin/F16x64 cloned-f16.img
Formatting 'cloned-f16.img', fmt=qcow2 size=21474836480
backing_file='/dev/vg_pin/F16x64' encryption=off cluster_size=65536
$ qemu-kvm -hda cloned-f16.img -m 1024
[boot it, shut it down]
$ virt-ls -lR -a /dev/vg_pin/F16x64 / > original.files # *
$ virt-ls -lR -a cloned-f16.img / > modified.files
$ diff -u original.files modified.files
--- original.files 2012-05-22 13:11:00.949456251 +0100
+++ modified.files 2012-05-22 13:11:38.248133406 +0100
@@ -1651,7 +1651,7 @@
- 0644 373 /etc/rearj.cfg
l 0777 14 /etc/redhat-release -> fedora-release
- 0644 1787 /etc/request-key.conf
-- 0644 79 /etc/resolv.conf
+- 0644 74 /etc/resolv.conf
l 0777 11 /etc/rmt -> ../sbin/rmt
- 0644 1615 /etc/rpc
d 0755 4096 /etc/rpm
@@ -32090,6 +32090,7 @@
d 0775 4096 /sys
d 1777 4096 /tmp
d 1777 4096 /tmp/.ICE-unix
+s 0777 0 /tmp/.ICE-unix/1061
s 0777 0 /tmp/.ICE-unix/1085
d 1777 4096 /tmp/.Test-unix
d 1777 4096 /tmp/.X11-unix
@@ -207760,7 +207761,7 @@
- 0644 28 /var/lib/AccountsService/users/rjones
d 0755 4096 /var/lib/NetworkManager
- 0644 87 /var/lib/NetworkManager/NetworkManager.state
-- 0644 1454 /var/lib/NetworkManager/timestamps
+- 0644 1502 /var/lib/NetworkManager/timestamps
d 0755 4096 /var/lib/PackageKit
- 0644 9216 /var/lib/PackageKit/transactions.db
d 0755 4096 /var/lib/alsa
[etc etc]
However there are some shortcomings. It won't find differences in:
- filesystem metadata
- bootloaders or other information outside the regular filesystem
- inside the Windows Registry (it'll just say the two binary
blobs are different)
Rich.
* You don't need the --checksum option unless files are modified but
keep the same size, in which case you have to examine the complete
content of each file. Using --checksum is much slower. 'virt-ls'
has other options that you may want to look at.
--
Richard Jones, Virtualization Group, Red Hat
http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/