Solved

Strange Directory being used as a file - Solaris 9

Posted on 2006-11-01
2
218 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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…
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.

756 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