The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
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

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 08-06-2007
Registered User
 

Join Date: Apr 2007
Posts: 37
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
Reply With Quote
Forum Sponsor
  #2  
Old 08-06-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
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.
Reply With Quote
  #3  
Old 08-06-2007
Registered User
 

Join Date: Apr 2007
Posts: 37
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
Reply With Quote
  #4  
Old 08-06-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
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.
Reply With Quote
  #5  
Old 08-06-2007
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,619
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.
Reply With Quote
  #6  
Old 08-07-2007
blowtorch's Avatar
Supporter
 
Join Date: Dec 2004
Location: Singapore
Posts: 2,326
Quote:
Originally Posted by Perderabo View Post
The block sizes are important.
I agree. And I never said they weren't. I meant that apart from the block sizes, this is another possibility.
Reply With Quote
  #7  
Old 08-07-2007
Registered User
 

Join Date: Apr 2007
Posts: 37
Thank you very much. Every answer was helpful.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:37 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0