Operating System - HP-UX
1752815 Members
5609 Online
108789 Solutions
New Discussion юеВ

cksum / sum problem & question

 
SOLVED
Go to solution
Robin Abecasis
Advisor

cksum / sum problem & question

I'm using HPUX 10.20, and i have come across a situation i was hoping that someone would be able to help me with.

sum -p and cksum are the same, they use the same algorithm and produce the same results.

My problem is with doing a cksum (or a sum -p) on a directory that exists on multiple machines. If i have say, dir1 on system1, and i rcp -rp the dirtectory to another machine, so that dir2 on system2 is an exact copy of dir1 on system1, and then do a cksum on those 2 directories... why do i get a different checksum result!?

Is there something i'm missing here? Does cksum not work on directories? Why should the checksum differ for an exact copy of the same directory on a different machine?

Here's hoping...

Cheers,
Robin
Wots going on 'ere then?
4 REPLIES 4
James R. Ferguson
Acclaimed Contributor

Re: cksum / sum problem & question

Hi:

As directories (or the contents thereof) grow, addtional blocks of disk need to be allocated to hold the additional inode information. Once allocated, no shrinkage occurs. However, when a copy is made, only the required space is allocated. Often this is less than the "current" size, leading to a different checksum when examined.

...JRF...
Robin Abecasis
Advisor

Re: cksum / sum problem & question

Thanks for the prompt reply...

Can you think of any way that i can counteract this behaviour such that the checksum would be the same??

Cheers,
Robin
Wots going on 'ere then?
Bill Hassell
Honored Contributor
Solution

Re: cksum / sum problem & question

The only way to counteract this issue about directories is to build them the same way. On the source machine, create a new directory, then create the files and then copy them. Otherwise, sum is telling that they are not identical at the bit level which is correct, but from a functional level, they are identical.


Bill Hassell, sysadmin
Jerry U
Advisor

Re: cksum / sum problem & question

i like to do a find and then an ls -l on each file and diff the two.

or ls -lR /top_of_tree and diff those two. they should be exactly the same. note that cp doesn't copy setuid bits. (just as is set on the oracle binary)