Re: cp with verify?
- From: "RolandRB" <rolandberry@xxxxxxxxxxx>
- Date: 12 Jan 2007 10:39:05 -0800
Michael Tosch wrote:
RolandRB wrote:
When I was using MS DOS I could specify a "verify" option with the copy
so that it would read back in the block it had written and verify that
the checksum was the same as the block it just copied and if the
checksum differed it would rewrite the block (at least I believe it
worked that way). Now I am working on various Linux and Unix flavors
(AIX 5.2 currently) where file integrity is extremely important and I
am wondering what facilities exist for both administrators and
end-users to do a "verify" on the file or batches of files copied. I
know about the "sum" command but don't have a script that can handle
doing the checksum and retrying if it fails using the usual parameters
given to "cp". Can somebody point me to a web site that covers this
issue of verified copies?
Thanks,
Roland
cmp compares two files.
To do a comparison after a successful cp:
cp "$file" "$dest" && cmp "$file" "$dest" || echo "failed"
That's a good idea. Thanks! The files are likely to be circa 1 Gbyte
binary files and "cmp" will work on binary files and it would be a more
thorough check but I am wordering about the speed of it compared to
doing a less thorough "sum" checksum. Most likely a number of files of
this size will be copied across in bulk.
But if you trust the Unix kernel and the hardware then you can
just check cp's exit status:
cp "$file" "$dest" || echo "failed".
I am wondering if it is possible for "cp" to return a zero return code
but the copy not to be a perfect copy.
--
Michael Tosch @ hp : com
.
- Follow-Ups:
- Re: cp with verify?
- From: Doug Freyburger
- Re: cp with verify?
- From: Doug Freyburger
- Re: cp with verify?
- From: Stephane CHAZELAS
- Re: cp with verify?
- References:
- cp with verify?
- From: RolandRB
- Re: cp with verify?
- From: Michael Tosch
- cp with verify?
- Prev by Date: Re: cp with verify?
- Next by Date: Re: cp with verify?
- Previous by thread: Re: cp with verify?
- Next by thread: Re: cp with verify?
- Index(es):
Relevant Pages
|