Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Strange Directory being used as a file - Solaris 9

Posted on 2006-11-01
2
Medium Priority
?
225 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 21

Accepted Solution

by:
tfewster earned 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

773 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