- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Copy sizes are different
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:05 AM
тАО09-15-2003 06:05 AM
Copy sizes are different
' cp -rp /source_dir /destination_dir '
but when i do a bdf the sizes are different and so is the file sizes i have tried recopying, deleting etc, but still the same and i need to make sure the data copied over is identical
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:12 AM
тАО09-15-2003 06:12 AM
Re: Copy sizes are different
Better is to use tar for these occasions. Copi-ing directories may resume in less data. For each file a specific amount of space is used per file. do an ls -lad of all directories in both directories. This shows you the difference.
Also cp does not copy special files. tar does (not all, but read the man page for those).
So :
tar cvf - . | ( cd /to/new/dir; tar xvf - )
Of course you inittiate this command from the source directory.
Regs David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:14 AM
тАО09-15-2003 06:14 AM
Re: Copy sizes are different
You can also use cpio,
# find /source_dir | cpio -pcmudv /dest_dir
Hope it helps,
Robert-Jan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:15 AM
тАО09-15-2003 06:15 AM
Re: Copy sizes are different
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:15 AM
тАО09-15-2003 06:15 AM
Re: Copy sizes are different
Are you sure its not just the directorys that are different sizes?
Directory files grow, but never shrink, so when you get more than a certain number of files in a directory, the directory itself takes up slightly more space, but if some of the files in the dir are deleted it doesn't get smaller again.
A better way of checking whether your copy was successful is to look at just the files. Try this:
cd /source_dir
find . -type f -exec ll {} \; > /tmp/source
cd /destination_dir
find . -type f -exec ll {} \; > /tmp/destination
diff /tmp/source /tmp/destination
If this reports no differences your OK.
HTH
Duncan
I am an HPE Employee
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:17 AM
тАО09-15-2003 06:17 AM
Re: Copy sizes are different
cksum filename
Elena.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 06:26 AM
тАО09-15-2003 06:26 AM
Re: Copy sizes are different
Here is how 1MB file that occupies on two bytes can be created.
char buf = 'x';
fdes = open("myfile",O_RDWR | O_CREAT,0664);
write(fdes,&x,1);
lseek(fdes,1000000,0);
write(fdes,&x,1);
close(fdes);
This creates "myfile" writes "x" at the beginning of the file, skip 1000000 bytes, and writes a second "x" --- a sparse file.
This file would ls as 1000000 bytes but bdf as two blocks --- the intervening bytes are never allocated BUT when myfile is copied those intervening bytes will be padded with NUL's on the copied file and instantly bdf will report very different numbers. When directories are copied, the "holes" (artifacts of deleted files in that directory) are not copied so that directories commonly don't copy exactly.
bdf and ls are not very good tools to determine if a file has copied correctly. After all, the SIZE of the files may be identical but that says nothing about the CONTENTS of the file. A much better test is to run cksum of each file.
Here is one method:
On the source dir:
find . -type f -exec cksum {} \; | sort > srclist
Now on the destination:
find . - type f -exec cksum {} \; | sort > destlist
diff srclist destlist -- if any lines are reported you have problems.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-15-2003 07:41 AM
тАО09-15-2003 07:41 AM
Re: Copy sizes are different
Couple of things missing.
char buf = 'x';
FILE *fdes;
fdes = open("myfile",O_RDWR | O_CREAT,0664);
write(fdes,&des,1);
lseek(fdes,1000000,0);
write(fdes,&des,1);
close(fdes);