in reply to Re: unlink : reclaim inodes, etc.?
in thread unlink : reclaim inodes, etc.?

The Unix sa here is saying that there is no benefit in doing a mv and re-creating the directory.

I think JohnGG is saying the same.

bruce is saying that there is a potential performance issue if I just delete the files (keeping the last 30 days files only) - as the directory file will still reflect the previous size?

Any other views?

Thanks

Replies are listed 'Best First'.
Re^3: unlink : reclaim inodes, etc.?
by johngg (Canon) on Oct 04, 2007 at 10:23 UTC
    When a directory is created on a Solaris 8 platform it has a size of 8k. If you add a lot of files to that directory then that 8k will get expanded to cope. If you then delete most of those files the directory will not shrink back to 8k which is what bruceb3 points out. However, we are only talking a few kilobytes here and you are probably not going to have lots of directories all with enough files to cause the expansion. So I agree with your SA that it's not going to gain you much. If you contemplate a filesystem where there are going to be huge numbers of very small files (or symlinks, perhaps) you may run out of inodes before you run out of data space so consider reducing the bytes per inode when making the filesystem with newfs. Conversely, if you have a files system that has just a few large files, perhaps database files, increase the bytes per inode, thus creating fewer inodes and leaving more space for data.

    Cheers,

    JohnGG

      A few kilobytes for 500,000+ files?

      I don't think so.

      # cd /var/tmp # mkdir lots-of-files # cd lots-of-files # perl -e 'for (1..500000) { { open my $f, ">poop.$_" } }' # cd /var/tmp # ls -ld lots-of-files drwxr-xr-x 2 szbrhv staff 10240000 Oct 5 10:01 lots-of-files

      That is 10 meg just for the directory, which might not be a concern with the large disks available but it's still a lot more than a few kilobytes.

        Yes, you are right. A lot more significant than I thought. I guess what I have looking at before is 500,000+ files in a large tree structure rather than all in a single directory.

        Sorry,

        JohnGG