Operating System - HP-UX
1826583 Members
3816 Online
109695 Solutions
New Discussion

Re: Cpio and integrity data

 
SOLVED
Go to solution
Mayca Jimenez
New Member

Cpio and integrity data

Is there some guarantee of the data integrity with cpio command to copy data from one directory to another?

3 REPLIES 3
Bill Hassell
Honored Contributor
Solution

Re: Cpio and integrity data

The degree of intergrity is the same as any other copy mechanism (cp, tar, etc). To be sure, you should run cksum on every file in the source and destination. NOTE: The destination space usage will generally *NOT* be the same as the source (tools like ll, du, bdf and df will not match). But that is not important. Only the checksums are important. For an explanation, search the forum for the term sparse files.


Bill Hassell, sysadmin
Mayca Jimenez
New Member

Re: Cpio and integrity data

Many thanks for you info.
I have copied a 250 GB file system with many directories and files and I would like to do the cksum for all files.
Do you know how I could do that task without having to go to every directory?
Bill Hassell
Honored Contributor

Re: Cpio and integrity data

You'll have to check every file and compare the results. Well, you won't, let the computer do the work:

find /old-dir -type f -exec cksum {} \;
find /new-dir -type f -exec cksum {} \;

Now that produces a long listing of all the files. To compare them, you'll have to sort both lists and use diff:

find /old-dir -type f -exec cksum {} \; | sorrt -k3 > /var/tmp/oldcksum
find /new-dir -type f -exec cksum {} \; | sort -k3 > /var/tmp/newcksum
diff /var/tmp/oldcksum /var/tmp/newcksum

If there is no output from diff, then the lists are the same. Note that if one or the other filesystems is not a top-level mountpoint then lost+found will not appear. This is perfectly normal.


Bill Hassell, sysadmin