From owner-freebsd-questions@FreeBSD.ORG Wed Sep 12 22:21:13 2012 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6AF63106566C for ; Wed, 12 Sep 2012 22:21:13 +0000 (UTC) (envelope-from kline@thought.org) Received: from p3plsmtpa07-08.prod.phx3.secureserver.net (p3plsmtpa07-08.prod.phx3.secureserver.net [173.201.192.237]) by mx1.freebsd.org (Postfix) with SMTP id 4583B8FC08 for ; Wed, 12 Sep 2012 22:21:13 +0000 (UTC) Received: (qmail 1689 invoked from network); 12 Sep 2012 22:14:33 -0000 Received: from unknown (209.180.213.209) by p3plsmtpa07-08.prod.phx3.secureserver.net (173.201.192.237) with ESMTP; 12 Sep 2012 22:14:32 -0000 Date: Wed, 12 Sep 2012 15:14:31 -0700 From: Gary Kline To: Karl Vogel Message-ID: <20120912221431.GC19460@ethic.thought.org> References: <20120911213804.GA9817@ethic.thought.org> <20120912011443.5df17cf2.freebsd@edvax.de> <20120912002408.GA10496@ethic.thought.org> <20120912011725.GG3066@hs1.VERBENA> <20120912181105.77E05BEA6@kev.msw.wpafb.af.mil> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120912181105.77E05BEA6@kev.msw.wpafb.af.mil> User-Agent: Mutt/1.5.21 (2010-09-15) Cc: freebsd-questions@freebsd.org Subject: Re: cksum entire dir?? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2012 22:21:13 -0000 On Wed, Sep 12, 2012 at 02:11:05PM -0400, Karl Vogel wrote: > >> On Tue, 11 Sep 2012 14:38:04 -0700, Gary Kline wrote: > > G> I'm trying to checksum directories as I move them around. ive read the > G> man page for sum and cksum ... or maybe skimmed them. no joy. anybody > G> know of a utility to do this? I've got files that are decades old... > > I wouldn't use CRC32 to check file integrity; use SHA1 or MD5 at the > very least. See http://home.comcast.net/~bretm/hash/8.html for details. [root@ethos klinebak]# yum install sha1 Loaded plugins: langpacks, presto, refresh-packagekit adobe-linux-x86_64 | 951 B 00:00 rpmfusion-free-updates | 3.3 kB 00:00 rpmfusion-nonfree-updates | 3.3 kB 00:00 updates/metalink | 18 kB 00:00 No package sha1 available. Error: Nothing to do [root@ethos klinebak]# see, nothing; I tried to install sha256 as well. zip. but md5sum I have, so that will serve. > > >> On Tue, 11 Sep 2012 18:17:25 -0700, > >> Colin Barnabas replied: > > Are you by any chance a "Dark Shadows" fan? I havent a clue what that is; if it's a tv show, no. same w/ movies. > > C> This works for me: > C> $ find foo/ -type f -print0 | xargs -0 md5 >> foo.md5 > > I do something similar when copying files to a backup server; it's not > unheard of for SSH to drop a session or a drive to have a bad spot. > > An easy-to-automate way is: get a list of files, use the hash of your > choice to generate signatures, sort the signature file by the hash, and > then get the hash value of the signature file. Here's an example using > my bin directory: > > me% ls > aline dir hist makecfg mx ro > authlog diskused isodate makekey mylook setperm > avg dline kernlog makepass n32 sha > buildenv dnslog lastdom mb n64 sshlog > cline dosrc linkdups md5path nr sulog > cmdlog dot ll memuse ntplog syslog > conlog dp lsl mgrep pathinfo tc > core f lslm mk ping tcv > cronlog fixhist lsn mkdtree plog tl > daemonlog fmt lsnm mkproto pwgen tr0 > dblog getperm lss mkrcs r tx > dbrun google lssm mongolog rand vi > dh haval lst month range zp > dig help2man lstm mv2inode > > me% find . -type f -print0 | xargs -0 md5 -r | sort > /tmp/dir.md5 > > me% cat /tmp/dir.md5 > 01328aeb4fd0eb3d998f4d7ad407a73f ./setperm > 017d6d622fb93bf7f23c0fb7b96b16eb ./core > 0287839688bd660676582266685b05bd ./mkrcs > 0b97494883c76da546e3603d1b65e7b2 ./pwgen > ... > ddbed53e795724e4a6683e7b0987284c ./authlog > ddbed53e795724e4a6683e7b0987284c ./cmdlog > ddbed53e795724e4a6683e7b0987284c ./conlog > ddbed53e795724e4a6683e7b0987284c ./cronlog > ddbed53e795724e4a6683e7b0987284c ./daemonlog > ddbed53e795724e4a6683e7b0987284c ./kernlog > ddbed53e795724e4a6683e7b0987284c ./ntplog > ddbed53e795724e4a6683e7b0987284c ./sulog > ddbed53e795724e4a6683e7b0987284c ./syslog > ... > fdff1fd84d47f76dbd4954c607d66714 ./dbrun > ff5e24efec5cf1e17cf32c58e9c4b317 ./tr0 > > The *log files are hard-linked, hence the duplicate MD5 values. > right. > me% md5 -r /tmp/dir.md5 > fdc34a5a5df7807d4fc45739d2d3039f /tmp/dir.md5 > > If I copy these files elsewhere, I can repeat the steps and just compare > the final hash; if it's anything other than 'fdc34...3039f', something's > wrong. well, the full story is my new system admin left my desktop 3/4 or 7/8 or 15/16ths in shardes. I have to-be-made-whole files/dirs in /home/kline. copies from two primary computers are scattered all over. I/ it won't be the-end if I lose a few favorite songs, but I wantto make certain that my devel and journal and writing dirs and a few others are md5sum flawless. thanks for youw howto across machines, karl. I'll save this in my howto file. my present desktop is temp; I'll turn it into a server ---just-in-case. then will use my server for backups. gotta match up. > > -- > Karl Vogel I don't speak for the USAF or my company > > When In Doubt, Empty The Magazine --bumper-sticker seen on military base > _______________________________________________ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org"