[NTLUG:Discuss] huge file/directory size in ..

Patrick R. Michaud pmichaud at pobox.com
Tue Apr 3 11:51:31 CDT 2012


It can also be that the parent directory once had a lot
of files/directories in it, even if it now does not.
Directories often don't shrink in size on the filesystem;
once a directory file holds thousands of file entries, it remains
large enough to hold thousand of file entries, even if there
are far fewer (or even zero).

One way to "fix" it might be to create a new directory for the
parent, move the remaining files from the existing parent
directory into the new one, remove the (now-empty) parent
directory, and then rename the new directory to the parent.
The new parent directory should then be smaller (i.e., only
large enough to hold the needed entries).

Be extra careful if any of the directories or files
involved are mountpoints or symlinks or the like, or if
there are any processes potentially holding links to the
files (i.e., don't follow the above suggestion blindly).

Pm


On Sun, Apr 01, 2012 at 11:50:13PM -0500, David Stanaway wrote:
> Looks like the parent directory has a lot of files/directories in it.
> 
> ls -al .. | wc -l
> 
> On 4/1/2012 7:43 PM, o k wrote:
> >All.
> >
> >Can any one let me know what is going on here?
> >It says there are 24344 files and the size is huge on .. directory, but only see 2 files.
> >i know I a wrong sed command and creates a huge sed* files. I think i deleted them.
> >How do I fix the problem?
> >thanks.
> >
> >[root at megan6 dd]# ls -al
> >total 24344
> >drwxr-xr-x.  2 root root     4096 Apr  1 19:40 .
> >dr-xr-x---. 26 root root 24903680 Apr  1 12:07 ..
> >-rwxrwxrwx.  1 root root      972 Apr  1 09:35 dd.orig
> >-rw-r--r--.  1 root root        0 Apr  1 19:40 dd.txt
> >  		 	   		
> >_______________________________________________
> >http://www.ntlug.org/mailman/listinfo/discuss
> 
> 
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss



More information about the Discuss mailing list