du reporting problem

I was using rysnc to transfer files from an older redhat file server to a new server with suse 10.3 installed. I noticed when I checked the copied partiton size against the original, that du would give me different numbers for the two partitions. Thinking that this could be a possible copying error, I used MD5sum to check file sizes. The file sizes seem fine, so du must be reporting things differently for the two systems (others have posted similar problems). Both partitions on the two machines are 20 GB in size with reiserfs formating, but one shows up as having ~ 4 blocks difference in size. When I map both drives in Windows, they both show up as the same size. Is there a good Linux utility that someone can recommend for checking directories after copies like this that will show if I am accurately copying these partitions?

du also counts disk space that is used by the inodes, indirect blocks, etc. Block sizes, inode sizes too will affect the result. Sparse files that are not sparse on the other system, but behave the same when read will also affect the result. Not to mention if one filesystem is type X and the other is type Y. It is after all, disk usage, not file size that it’s attempting to approximate.

To reliably know if you transferred the files correctly you should do checksums on the files. Or trust rsync to get it right.

Thanks, I guess I’m not the trusting type, rysnc seems to work perfectly well without error, but I was hoping to find some easy way to verify if I was correctly copying a 1.5 TB RAID array

DFHansen wrote:

>
> Thanks, I guess I’m not the trusting type, rysnc seems to work perfectly
> well without error, but I was hoping to find some easy way to verify if
> I was correctly copying a 1.5 TB RAID array
>
>

Normally, as Ken mentioned, du reports sizes based on block/cluster size. To
see “true” size, use the --apparent-size option with du.

returns sizes in ‘K’ (1024) (some rounding)

du --apparent-size /huge/dir

returns sizes in bytes

du --apparent-size -b /huge/dir

Loni


L R Nix
lornix@lornix.com

Bingo!! Thanks, I was using an old version of du on the redhat machine that did not support the --apparent-size option. RTFM should be modified to RTNFM, N standing for New!!

Wait a minute, this should be a new linux command! rtm -vn -c3 DFHansen redirects me to read the manual, new, out loud (verbose), three times

DFHansen wrote:

>
> Wait a minute, this should be a new linux command! rtm -vn -c3 DFHansen
> redirects me to read the manual, new, out loud (verbose), three times
>
>

Hmmm, interesting command… does it have a ‘whilst standing on head’ option
too?

I have to go through and scan the man pages every once in a while myself.
Usually try “du -h”, then “du --help” then “man du”, then “locate du”, then
googling du… reading newsgroups, etc… (substitute du for desired command)

Note to self: ‘shutdown -h’ is NOT a useful command if you’re not expecting
it!

Loni


L R Nix
lornix@lornix.com

With regard to sparse files, you need proper rsync options to transfer them sparsely.