Solved

Strange Directory being used as a file - Solaris 9

Posted on 2006-11-01
2
213 Views
Last Modified: 2013-12-27
There are a couple of directories that appear like they are being used as files:
audit = 114688 bytes
fmlogin.db = 10240 bytes

There is nothing in these directories; no files, no pipes, no directories!  If I do a "od -c audit" it is filled with binary (like "\0 \0 \0 \0 \0") just like a "normal" directory, but bigger.

But for an EMPTY directory why is the size so big?

If I do a "cp -pR audit temp0" the "contents" of audit are not copied.  ls -l temp0 = 96 bytes, just like a normal directory.

Isn't the size shown for a "ls -l" of a directory = size of inodes being used?

Many thanks, Allan

0
Comment
Question by:huffmana
2 Comments
 

Author Comment

by:huffmana
ID: 17850469
I just found out what is going on!!!

The size a directory listed in "ls -ld dirname" never goes down.  Put 1000 files in a directory and the number gets big.  rm -rf all the files in that directory (so that there is nothing in the directory), and the number STAYS BIG!  The number never goes down.

Strange!  Is this normal behavior for Solaris 9?
0
 
LVL 20

Accepted Solution

by:
tfewster earned 500 total points
ID: 17853445
Yes, it's the same for all versions of Unix; A "directory" is just another type of file, containing pointers to "real" files and the names* of those files. As the number of files in the directory grows, obviously the directory file has to grow. And if files are deleted, the directory file is not shrunk, the entries are just replaced with nulls.


* Interestingly, a file doesn't really have a name of its own - The directory entry contains label (the "filename") and a pointer to an i-node.  A hard link to a file consists of another filename and pointer to the same i-node
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now