[kwlug-disc] scp file size

John Van Ostrand john at netdirect.ca
Tue Dec 21 14:28:38 EST 2010

----- Original Message -----
> I'm nervous. In preparation for an OS upgrade, I copied my home
> directory over to another machine. When I do a 'du', I'm getting 20
> gigs on the copy, 23 gigs on the original.
> From my home directory /home/user I did the following:
> scp -r -C *
> 'du' issued at shows 20 gig.
> 'du' issued at /home/user shows 23 gigs.
> Directory listings sure seem the same based on a cursory inspection.
> Where's my 3 gigs?

The results of 'du' are not just the sum of all files. It will be the number of disk blocks used to store the data. On average one half of a blocksize of data will wasted for every file on the disk. For example a 1 byte file takes up 4K of space. Directories take space too, the more directories, the more disk space used.

So one big difference is the type of file system and how it's configured. Different file systems will store information more or less effectively. 

It could also be in hidden files.

It could also be a huge directory somewhere (although 3GB is really big). If you once stored 1000s of files in a directory before moving them to another, that first directory may still take up the same space, perhaps megabytes if it was large enough.

Something I'm not sure of is sparse files. These are files that are not completely allocated. I've never worked with them so I don't how if this would contribute.

John Van Ostrand 
CTO, co-CEO 
Net Direct Inc. 
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
Ph: 866-883-1172 x5102 
Fx: 519-883-8533 

Linux Solutions / IBM Hardware 

More information about the kwlug-disc mailing list