Operating System - HP-UX
1835272 Members
2436 Online
110078 Solutions
New Discussion

ll command list the same size in files between two servers but different total size

 
SOLVED
Go to solution
palomitas
New Member

ll command list the same size in files between two servers but different total size

I have two itanium servers, one primary and the other backup, they have almost the same data. There is one directory in both servers, containing the same files, ll command show in the first line the total size of the directory and the size of every file, the servers show the same size for every file, but a very different amount about the total size between both servers (about 20 times more in one server). I used lsof command, but there are not files of this directory in the list. bdf command show a difference about 15% between both servers, and du command show differences too. What can i do if i need the same physical size of the files in both servers?
2 REPLIES 2
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: ll command list the same size in files between two servers but different total size

First, don't be concerned about differences in sizes of directories, that is to be expected as one directory may have many deleted entries while the other may have few. What you are seeing is almost cerinly the result of sparse files. Consider a file that writes 1 byte at offset 0 and then does an lseek to offset 1024*1024 -1 and writes one bytes. You now have a file that has 2 real bytes but ls -l will show the size as 1MiB. When a sparse file is read, the "missing" bytes are silently filled in with ASCII NUL's. If you copy a sparse file to another file, the holes are filled in and the new file actually uses all the space. To "fix" your problem (which really isn't a problem), you need to copy your files and then copy them back to the original locations or use a transfer mechanism liker fbackup which can preserve the sparse data.
If it ain't broke, I can fix that.
James R. Ferguson
Acclaimed Contributor

Re: ll command list the same size in files between two servers but different total size

Hi:

I am not surprised by your observations. As files are added to a directory, the space consumed for the directory's metadata (the information *about* its contents) increases. As files are deleted, however, the directory's allocated space is not returned; rather only freed for reuse.

A very common observation is to copy a directory and all of its contents to a new directory and find taht the the overall size of the new directory and its contents is less than the old one.

If you wish to assure yourself that the contents of two directories are equal, checksum every file therein in both directories. An equality in the checksums of every file assures you that the directories are "equivalent". Size matters not.

Regards!

...JRF...