Operating System - HP-UX
1833692 Members
4475 Online
110062 Solutions
New Discussion

Question about directories.

 
SOLVED
Go to solution
Richard Pereira_1
Regular Advisor

Question about directories.

Hi,

11.11
vxfs
patch bundle december 2004

Need a sanity check on what i see in a ls output;

drwxr-xrwx 2 psoft gpsoft 22945792 Aug 2 10:50 logsWaitingToRemove
# cd logsWaitingToRemove
# ll | wc -l
6324
# bdf .
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvpsoft 94044160 80080196 13803424 85% /psoft

Cust reports that the 22945792 number rarely changes. even if he reduces the file count to 2k or less. Want to know what this number represents.... thats just a representation of pointers, right?

Just need to explain this to the cust so they dont flip out over nothing.

Regards,
Richard
4 REPLIES 4
Patrick Wallek
Honored Contributor

Re: Question about directories.

That is the size of the directory file itself. Mind you it is NOT the total size of the contents of the directory.

You will see that grow as needed as files get added to a directory. However, when you remove files from a directory, that size does *NOT* shrink.

The only way to shrink it is to remove it and recreate it.
Jean-Luc Oudart
Honored Contributor

Re: Question about directories.

As mentioned in post above, the inode block are not released. The only way is to rebuild the directory.
I came across same issue (with log directory too !). If you can take it offline that should not take too long.

also check thread :
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=619233

Regards
Jean-Luc
fiat lux
TwoProc
Honored Contributor
Solution

Re: Question about directories.

This is correct. The number won't reduce.
This number isn't the size of the file space used in the directory, it's the size of the file structure. Directory structures just grow. If you remove most of the files in the directory, the structure would remain the same size, overly simplified as just full of null pointers (instead of pointers to inodes).

If they want to see that size of the CONTENTS of the directory is smaller - then do a du -sk logsWaitingToRemove. You'll see that the size of files used by the directory does reduce, just not the size of the directory structure, which is just a bunch of pointers.

If you want to reduce the size of the dir structure, then make another directory (sibling directory) and move everything into the new directory (wont take but a second), remove the logsWaitingToRemove directory, then rename the new directory to logsWaitingToRemove.

mkdir temp
mv logsWaitingtoRemove/* temp
rmdir logsWaitingtoRemove
mv temp logsWaitingtoRemove
We are the people our parents warned us about --Jimmy Buffett
Richard Pereira_1
Regular Advisor

Re: Question about directories.

Thanks guys, I wont recreate (as i expect it to fluctuate often) but I want to confirm its indeed the structures and its normal that the number doesnt reduce. Thanks for the sanity check.