cksum entire dir??

Polytropon freebsd at
Thu Sep 13 23:42:05 UTC 2012

On Wed, 12 Sep 2012 10:46:25 -0700, Gary Kline wrote:
> On Wed, Sep 12, 2012 at 07:31:45AM +0100, Matthew Seaman wrote:
> > 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.
> > 
> 	So this sha256 is *real*??  I have no md5 on my "fedora"
> 	that is on my desktop and m having trouble getting used to.  
> 	but the gentleman who recommened cpio was right on the money.
> 	note that I am loathe to spam this list with the following mail from my
> 	files in sept, 1988, but here it is.  if I had only gr -r -w cpio
> 	around in all my directories, I would have found this, sent to one Dirm
> 	Myers across the pond ::
> 	===
> From kline Sat Sep  5 11:52:20 1998
> Subject: lost mail file...
> To: dirkm at (Dirk Myers)
> Date: Sat, 5 Sep 1998 11:52:20 -0700 (PDT)
> Organization: <> public access uNix in service... <>
> X-Mailer: ELM [version 2.4ME+ PL32 (25)]
> MIME-Version: 1.0
> Content-Type: text/plain; charset=US-ASCII
> Content-Transfer-Encoding: 7bit
> Content-Length: 2283
> Status: RO
>   Yesterday morning I began composing the next two Q's and A's
>   in my mailer.  Last night in the wee hours there was a power
>   glitch and I lost the mail.
>   Enclosed is the first//next Q/A.  I'll send along another one
>   or two later today.  One that I was playing around with *failed*
>   and I'm trying to figure out why.
>   -----
>   How can I uise my FBSD floppy drive to copy files to it (in this case,
>   at work), and retrieve the files on my FBSD systtem at home.  So far
>   I've only seen examples that used floppies with a filesystem on them.
>   Is there a simplr, more direct way?
>   You can treat the 'raw' floppy device as if it is a tape drive, and
>   use typically UNIX tape tools to read/write, such as tar and  cpio.
>   For instance, to copy the current directory onto a floppy to
>   take home at night:
>         (put the floppy in the drive, and cd to the directory where
>          the files are; then )
>         % tar -cvf /dev/rfd0 .
>   To read it when you get home:
>         (put the floppy in the drive at home; and extract the tarball
>          wherever you want the files)
>         % tar -xvf /dev/rfd0
>   The flags -c and -x indicate create and extract mode, the ``v''
>   specifies verbose mode, and the ``f'' tells tar that the following
>   argument is the file or device that tar acts upon.  Here, it is
>   the floppy devide.
>   With cpio:
>         (chdir to the directory where the files are)
>         % ls | cpio -oc > /dev/rfd0
>        To read a cpio archive from a tape drive:
>        % cpio -icd < /dev/rfd0
>        The flags -i and -o indicate copy-in or extract mode and
>        copy-out or create archive mode.   The ``c'' tells cpio
>        to use the old, portablr ASCII archive format.  And the
>        ``d'' flag tells cpio to create directories where necessary.
>        Do a
>        % man cpio
>        for much greater detail on this utility.
>   -----
>   There are another one or two of the simpler Q/A's and one or two
>   more involved.
>   Then, for this month only, I want to write a paragraph or two
>   about who I am and where I'm coming from.  Since you are sharing
>   the by-line you might want to consider this too.
>   gary
>   PS:   Next month we get a break!!
> --
>    Gary D. Kline         kline at          Public service uNix
> 	====
> 	as you can see, this dealt with my olden tape drive.  a 250meg
> 	QIC drive, I think.  

Really? I think /dev/rfd0 refers to fd - floppy disk. Even
though I know there are floppy-controller connected tape
drives (still have one myself!), the examples shown seem
to indicate work with a floppy disk, used in a "non-fs'ed"
manner, just as I did in the past with "tar, the most
universal file system that isn't even a filesystem" to
transfer files across different UNIX / BSD / Linux boxes
via floppy (because they've not been networked). Still the
examples look fully valid when applied to a tape drive, as
both floppy and tape can be (ab)used as "linear fs-less
media". :-)

>  but this was about the earliest reference 
> 	I could find re my use of cpio.  there are others in my journal 
> 	dir that reference my running out of hard drive and using cpio rather
> 	that a straight cp -rp. 

I've been using cpio as a means of backup in combination
with a "chain" of 650 MB CD-R's.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list