[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [Libguestfs] guestfs-examples

On Tue, Mar 05, 2013 at 05:04:05PM +0100, Khan Ferdous Wahid wrote:
> I have upgraded my kernel as you mentioned and everything is fine
> now. I wrote the following code to check the integrity of /boot
> directory in guest image. Now my question is- how could I check the
> integrity of files that are modified in last 10 minutes inside /boot
> directory? I use boot directory as an example directory.

AIUI you want to display the checksums of files in /boot which have
been modified within the last 10 minutes?  Recursively or just to
/boot directory without subdirectories?

The easiest way is:

  virt-ls -lR -a disk --checksum --time-relative /boot | awk '$6 <= 10*60'

If you want to do that in C instead of using virt-ls, then take a look
at the source of virt-ls -- it is written in C.  A good place to start
would be here:


especially the functions 'visit', 'show_file' and 'do_ls_lR'.

I would caution you that the 'visit' function shown above would have
trouble with very large directories *if* using libguestfs < 1.20.
These bugs were fixed in libguestfs 1.20 and above.


Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-p2v converts physical machines to virtual machines.  Boot with a
live CD or over the network (PXE) and turn machines into KVM guests.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]