Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Strange Directory being used as a file - Solaris 9

Posted on 2006-11-01
2
Medium Priority
?
221 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

722 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