Stewart Stremler wrote:

begin  quoting Ralph Shumaker as of Wed, Sep 21, 2005 at 07:48:37PM -0700:
As suggested by some on the list, I tried cpio for copying whole partitions (not to mention using dd) and parts of partitions. I did not find it any better than cp with the appropriate switches, but in fact worse.

Interesting!

So far, I like cp the best. But there is primarily one thing that I do *not* like. It doesn't keep the timestamps of links. I tried touching

What options are you passing to cp?

I don't remember for sure. I was doing all this from Knoppix, so I don't have the command history. I also don't have around me the paper on which I wrote the switches I chose to use. Oops. I spoke to soon. The paper I most recently used (with knoppix v3.4) has:

cd [source directory]
cp -rvpd ./* [target directory]

One other thing that was a bit odd was that this command copies just fine any dot files below the starting directory but ignores the dot files (in my case they were dot directories and their contents) that are actually in the starting directory.


a few of the destination links after the copy, but instead of the links' timestamps changing, the timestamps were changed on the files to which they link.

The simplest way that I can think of to verify all files copied over is to "ll -aR > ll-aR.hde2" and "ll -aR > ll-aR.hdg2" and then "diff ll-aR.hde2 ll-aR.hdg2 > ll-aR.hdg2-hda2.diff", but every link shows up

Er, what's the ll business? That's a common alias for "ls -l", but it's
not a standard command on any of my Linux boxen.

Sorry. I'm actually aware that most on the list use "ls -l" instead of "ll" because that's the way they say it in their descriptions of how to do things that include that. I just forgot that the "ll" alias, although apparently standard in RH, is not universal. "Oops." is about all I can say I reckon.


there because of the timestamp. And there are a whole *lotta* links. I can pipe through a 'grep -v " --> "' and get a much smaller output. And although this assures me that the objects of the links copied fine, it eliminates the certainty that all *links* got copied. Is there a way to make cp keep the timestamps of the copied links? As far as I can tell, any attempt to modify the timestamp of the link just gets applied to its target.

What if the target isn't there?

mv $target $target.__save__
touch $link blah blah blah
mv $target.__save__ $target

Perhaps I'm just really tired, but I don't get what you're trying to say here. I get lines 1 and 3, but the purpose of line 2 eludes me. Also eluding me is why you're using "mv". I don't see how that relates to my question.


The other thing that is disconcerting about the cp, ll, diff I do is that directory sizes don't necessarily stay the same. If the size differs at all, usually the copy is taking less space. (I don't remember seeing any that ended taking more.) But this occurrence is much, much less frequent than the link dates changing.

Yes, that's expected.

I don't understand why, although I think I have an idea. But my idea is immaterial. When it comes to the actual size of the directory copy, I would prefer that the size matches, but am satisfied if all of that directory's contents match.



Is there a way to get a reliable listing of the source files, do a byte for byte comparison, and report only the ones that are different?

Isn't that what the cmp command does?

-Stewart "Never thought about looking at a link's timestamp before" Stremler

Yeah, well, I just feel better when the copy seems to be a perfect copy. I would actually prefer to *know* that the copy is just as reliable as the original. And if the dates or sizes are different, it just *feels* like they are not reliably the same.


--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to