LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   large directory while it is empty (https://www.linuxquestions.org/questions/linux-general-1/large-directory-while-it-is-empty-602399/)

Mrjas 11-26-2007 02:47 AM

large directory while it is empty
 
as shown below..

drwxrwxrwx 2 dispatcher dispatcher 20668416 Nov 26 04:13 AlJazeera

it shown that the size of the directory is 20668416

But when I try to list the directory using ls:
give total 0

by using ls -la the result is:
drwxrwxrwx 2 dispatcher dispatcher 20668416 Nov 26 04:13 .
drwxrwxrwx 15 dispatcher dispatcher 8192 Nov 19 2006 ..


is that normal ? if it is not, how can fix the problem?

matthewg42 11-26-2007 03:13 AM

I am not sure what the proper behaviour is. Probably it depends on the filesystem type / configuration. On my ext3 filesystem, I created a directory and created a bunch of files in it - seeing the size of the directory increase to store the names of the files and so on. Then I deleted the files. The directory size remained the same as it was when it was full of files.

I guess (for ext3 at least) that space is not recovered until you rmdir the directory and create a new one. I'm not sure of the reasons for this. If I had to guess I would say that it's simple more efficient to do that, and it might also help prevent fragmentation. Disk space is cheap, so it's probably a reasonable way to do things in most cases.

I'm going to pretend I didn't see the permissions on your directory listing, else I might start to worry about your system.

Mrjas 11-27-2007 05:20 AM

for more details:
I found that the /home directory is a shared.

systems A capacity is 98% --> the system which contain the bove problem

but with the other is 38%

and both have same contains of files and directoris.

matthewg42 11-27-2007 05:38 AM

I have absolutely no idea what you mean by post #3.

Mrjas 11-27-2007 09:52 PM

the system which i talked about in post#1, has shared /home directory,
it look that the capacity /home is 98%.
but it is 38% with other system shared same /home directory

matthewg42 11-27-2007 11:30 PM

By "shared", do you mean it is a remote filesystem mounted using samba or NFS?

Mrjas 11-28-2007 12:16 AM

by more /etc/fstab

find that:
LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
LABEL=/home /home ext3 defaults 1 2LABEL=/opt /opt ext3 defaults 1 2
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
LABEL=/tmp /tmp ext3 defaults 1 2
LABEL=/var /var ext3 defaults 1 2
/dev/sda7 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0

matthewg42 11-28-2007 12:37 AM

In what respect this this shared? Just looks like a normal disk to me.

Mrjas 11-28-2007 01:25 AM

yes it is,,,
and for more infomation the other mount directories have normal affect.
only /home has not affected

matthewg42 11-28-2007 01:31 AM

So what did you mean by "but it is 38% with other system shared same /home directory"?

Sorry, but this makes no sense to me at all.

Mrjas 11-28-2007 02:01 AM

that is the problem, this is not making sense for me also,

let explain by example:
system A & system B have shared directory on /home
system A shown that the capacity of /home 98%
but system B shown that the capacity of /home 38%

/home on system A not affected
/home on system B affected

both have same contains file as a share.....

this is my inquiring..

matthewg42 11-28-2007 02:20 AM

It just looks that it is not a shared directory at all... Please paste the output of this command from both machines:
Code:

mount |grep /home

Mrjas 11-28-2007 04:21 AM

[root@COM2 root]# mount | grep /home
/dev/sda2 on /home type ext3 (rw)
db1.thuraya.com:/home/scpusr/ss7files/ on /home/scpusr/ss7files type nfs


[root@DB1 root]# mount | grep /home
/dev/sda2 on /home type ext3 (rw)
[root@DB1 root]# hostname
DB1.thuraya.com


the Problem with COM2 system

indeliblestamp 11-28-2007 04:58 AM

Does du -h AlJazeera on com2 show any files? If it says its empty, and you think its empty, how about just removing it and recreating it?
rmdir AlJazeera
mkdir AlJazeera

jschiwal 11-28-2007 06:24 AM

The fifth column is the size of the directory (file) itself and not the size of the contents. I was able to verify that this number isn't reduced by deleting the contents of a directory. I had a directory with 10s of thousands of scrap files which I deleted. After deleting, the number in the 5th column of the ls -ld */ listing was still 8MB.


All times are GMT -5. The time now is 03:00 PM.