On 24 Feb 2008, at 11:46, Etaoin Shrdlu wrote:
> On Sunday 24 February 2008, Stroller wrote:
>
>> I've done this loads in the past, and never been aware of any file
>> corruption, but I guess I'm just paranoid today. Perhaps I shouldn't
>> use the -v flags during my copy - it's reassuring to see the files
>> being copied, but what if I overlooked a bunch of errors in the
>> middle of all those thousands of "copied successfully" confirmations?
>> What if something has gone wrong during one of the two copies?
>
> Well, in that case cp will have a nnonzero exit status. Look:
>
> ...
> $ cp a b destdir
> cp: cannot open `b' for reading: Permission denied
> $ echo $?
> 1
> ...
> I think this should hold for the majority of cases/errors cp might
> encounter during the copy.
Good point. I should have checked this when I first made the copy
using cp, and will do so in the future.
> Of course, this does not detect a succesful, but somehow corrupted,
> copy
> (which should be exceptionally rare, anyway).
Well perhaps I'm just being paranoid today.
But how do I know that a successful, but somehow corrupted, copy has
not occurred?
What makes you confident that these are rare? I don't ask this to be
antagonistic, just to increase my own confidence in the `cp` command.
>> Is there any way to check the integrity of copied directories, to be
>> sure that none of the files or sub-directories in them have become
>> damaged during transfer? I'm thinking of something like md5sum for
>> directories.
>
> I'm not aware of any such tool (which might exist nonetheless, of
> course). However, on the filesystem, the objects that we
> call "directories" are just index files holding filenames and pointers
> to inodes. Running a checksum on the directories themselves would not
> guarantee against corruption of any of the contained files, since file
> data is not contained in the directory.
Naturally.
Perhaps I should have phrased my question differently: "Is there any
way to recursively check the integrity of copied directories of
files?" However the words "to be sure that none of the files or sub-
directories in them have become damaged during transfer"
> Thus, to be accurate, such a
> tool would have to scan the directory, find each file, and perform a
> checksum on it, which would result in something not much different
> from
> the find command you suggested, in terms of resource usage.
I have to admit that I haven't run this command and I don't have any
idea what its actual resource usage would be. I guess I'd be happy
with a lower-grade of checksumming, if it would reduce the runtime to
acceptable levels. With md5sum one can be - barring certain malicious
external attacks - quite certain that a copied file is identical to
the original. I would be happy with a "the file's there and it looks
ok" level of confidence.
Stroller.
--
gentoo-user@lists.gentoo.org mailing list