public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
From: Stroller <stroller@stellar.eclipse.co.uk>
To: gentoo-user@lists.gentoo.org
Subject: Re: [gentoo-user] md5sum for directories?
Date: Wed, 27 Feb 2008 00:38:06 +0000	[thread overview]
Message-ID: <4D6E8244-D1D1-4F30-8BEE-83433B1389F9@stellar.eclipse.co.uk> (raw)
In-Reply-To: <200802241246.35965.shrdlu@unlimitedmail.org>


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



  reply	other threads:[~2008-02-27  0:38 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-24 11:06 [gentoo-user] md5sum for directories? Stroller
2008-02-24 11:46 ` Etaoin Shrdlu
2008-02-27  0:38   ` Stroller [this message]
2008-02-27  9:40     ` Etaoin Shrdlu
2008-02-24 14:29 ` Neil Bothwick
2008-02-24 16:39   ` cabbage
2008-02-24 16:46     ` Dirk Heinrichs
2008-02-24 16:49     ` Andrew Gaydenko
2008-02-24 19:46 ` Christopher Copeland
2008-02-27  0:51   ` Stroller
2008-02-27  2:36     ` Christopher Copeland
2008-02-24 21:15 ` [gentoo-user] " »Q«
2008-02-26 19:59   ` Mick

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D6E8244-D1D1-4F30-8BEE-83433B1389F9@stellar.eclipse.co.uk \
    --to=stroller@stellar.eclipse.co.uk \
    --cc=gentoo-user@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox