cksum entire dir??

Matthew Seaman matthew at FreeBSD.org
Wed Sep 12 06:32:08 UTC 2012


On 12/09/2012 00:14, Polytropon wrote:
> 	% cksum <directory>
> 
> and could obtain a checksum - so it _seems_ to work.
> After alteration of one file within the hierarchy a
> different result was printed.

That will give you a checksum on the directory inode -- file names and
associated metadata only, not file content.  In theory you could edit a
file without modifying any of the timestamps, and that wouldn't result
in any change to the directory checksum.  Also, modifying things a few
layers down the filesystem hierarchy won't have any effect either.

Generally I find the best test for differences between old and new
copies of a filesystem is 'rsync -avx -n ...'

Also, sum and cksum have way too small a key size for this to be
reliable, since you can't tell a true result from a hash collision.  Use
md5 or sha1 or sha256 for best results.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.
PGP: http://www.infracaninophile.co.uk/pgpkey


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 264 bytes
Desc: OpenPGP digital signature
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20120912/fbfa5212/signature.pgp


More information about the freebsd-questions mailing list