Operating System - HP-UX
1833758 Members
2240 Online
110063 Solutions
New Discussion

du -sk showing different sizes...

 
SOLVED
Go to solution
boomer_2
Super Advisor

du -sk showing different sizes...

Hi guys ,
i wanted to shift a directory contents from one dir to another..
/xyz vg00 12408..
mv xyz xyz_old
so i created another mountpoint called /xyz and put all the contents into it..
# cd xyz_old
# cp -pr * /xyz
but now the file size varies..
earlier originalw as 12408 and now its 96775
what do i do ???
6 REPLIES 6
Dennis Handly
Acclaimed Contributor

Re: du -sk showing different sizes...

>earlier original as 12408 and now its 96775
what do i do ???

You copied the holes in the sparse files and made them bigger.

I'm not sure if there is a backup tool that will preserve the holes.
boomer_2
Super Advisor

Re: du -sk showing different sizes...

hi dennis,
so it wont be creating any problem right..bcoz the file size varies...in both cases..

regards,
boomer..
Yogeeraj_1
Honored Contributor

Re: du -sk showing different sizes...

hi,

In this case, as long as the size is bigger, there should be any problem.

A mv would have been different.

You may also wish to cross-check the content of the two directories by running a "find" and doing a "diff" on the two outputs.

hope this helps too!

kind regards
yogeeraj

No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
Andrew Young_2
Honored Contributor
Solution

Re: du -sk showing different sizes...

Hi.

You would be better to run the find with a -exec doing a cksum on those files, output the output to seperate files and diff the files containing the checksums.

Regards

Andrew Y

Si hoc legere scis, nimis eruditionis habes
Bill Hassell
Honored Contributor

Re: du -sk showing different sizes...

Sparse files are a feature of all Unix systems and very often the situation with database files. The Unix file handling allows files to be created with giant 'holes' or unwritten locations. When you read the file, these unwritten holes are filled in with a stream of zeros. So the file may have a record at location 1 and another at location 1 million -- but nothing in between. This takes up very little space (2 records) on the disk yet the file has 1 million records. If you read the file (ie, the cp command *OR* the mv command IF the destination is on another mountpoint), all 1 million records are read and created. So the destination file takes up much more space than the original.

Now the important concept here is that both files are identical. If you run a cksum against each file, they will be the same. They are just stored differently. There is no simple way to recreate the original file so it uses identical storage without using the original program. The good news is that is you save these files to a tape using compression, the string of zeros will compress very highly, perhaps 5:1 to 20:1 depending on the data.


Bill Hassell, sysadmin
D Anderton
Advisor

Re: du -sk showing different sizes...

Use the dircmp utility to verify files :

dircmp xyz_old /xyz

This will compare the files for you :

same ./network
different ./passwd
same ./pm_cfg
same ./protocols
same ./resolv.conf

pipe the output to grep different, couldn't be easier !

dircmp xyz_old /xyz | grep -i different