[Libguestfs] guestfs-examples

Khan Ferdous Wahid khanferdous.wahid at gmail.com
Wed Mar 6 10:57:09 UTC 2013


Hi,
Sorry for the late reply. Yes, I want to display the checksums of files in
/boot which have been modified within the last 10 minutes, and I want to do
that in C. Thank you very much for pointing me to the right direction, and
thank you for always be so helpful.

Best regards,
Wahid


On Tue, Mar 5, 2013 at 6:25 PM, Richard W.M. Jones <rjones at redhat.com>wrote:

> 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:
>
>   https://github.com/libguestfs/libguestfs/blob/master/cat/virt-ls.c#L443
>
> 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.
>
> Rich.
>
> --
> 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.
> http://libguestfs.org/virt-v2v
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20130306/1ec4c880/attachment.htm>


More information about the Libguestfs mailing list