![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| SSH prompts password for non identical users | vjkatsun | UNIX for Advanced & Expert Users | 5 | 06-01-2008 10:18 PM |
| replace 2 identical strings on different lines | prkfriryce | Shell Programming and Scripting | 3 | 06-15-2007 08:18 AM |
| moving directories to new directories on multiple servers | mackdaddy07 | Shell Programming and Scripting | 0 | 04-06-2007 08:30 AM |
| list only identical filename | HAA | Shell Programming and Scripting | 6 | 05-17-2006 08:04 AM |
| How to check the files are Identical or not? | redlotus72 | UNIX for Dummies Questions & Answers | 3 | 07-06-2005 05:22 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
du -s -k differences between two identical directories
I tarred a directory from a linux server to a solaris server. When I do a du -s -k on the directory, I get almost 150k difference in the file sizes. If I do a ls | wc -l, it is the same. If I look at the size of the individual files, it is the same.
I did an ls on the 2 directories and notice when a directory is within a directories I checking, it can show as 4096 on the linux side and 512 on the Solaris side. Will this alter my results? I do not see any missing files or file size differences. The only difference is the directory size. I need to make sure these are identical directories? Any ideas or recommendations? Thanks |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
The size of the directory will make a difference. If you have to confirm that you have copied all the files, just run a "find . -type f" command on the directory on source and then on dest. Compare the two outputs. If they are the same, you don't have any problems. To really confirm that the files are copied across correctly, you can use cksum/md5sum on individual files and then compare the results.
|
|
#3
|
|||
|
|||
|
Thank you.
I believe all the files are there and the file sizes are the same. I am wondering is why the du -s -k reports different sizes. What is the difference in the directory size (ie) one is 4096 on solaris and it is 512 on linux. What parameters can I pass the du that they use the same, block size maybe, so the totals come out the same (if in fact they are the same). Thanks |
|
#4
|
||||
|
||||
|
It hasn't just to do with the block size. With a directory, as files are added, the size increases, but it doesn't reduce when files are removed. So a directory that had more files in it in the past will be larger than it should be.
If you take a tar of that directory and untar it on some other system/to some other location, the new directory that will be created will not (necessarily) the same size as the source directory. It will be only big enough to hold the current file list. |
|
#5
|
||||
|
||||
|
The block sizes are important. When you write a one byte file, you do not simply consume a single byte. The file system code must allocate the smallest unit of space that it can. This varies from filesytem to filesystem. If the smallest unit is 1024 bytes, that is what du reports. After all, when you delete the one byte file, 1024 bytes will be freed. Now copy the that one byte file to another filesystem where 8192 bytes is the smallest unit that can be allocated and du now reports that.
|
|
#6
|
||||
|
||||
|
I agree. And I never said they weren't. I meant that apart from the block sizes, this is another possibility.
|
|
#7
|
|||
|
|||
|
Thank you very much. Every answer was helpful.
|
|||
| Google The UNIX and Linux Forums |