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

o k aaasssxxx at hotmail.com
Thu Apr 19 13:14:37 CDT 2012




> Date: Tue, 3 Apr 2012 12:50:29 -0500
> From: wwalker at solid-constructs.com
> To: discuss at ntlug.org
> Subject: Re: [NTLUG:Discuss] huge file/directory size in ..
> 
> On Tue, Apr 03, 2012 at 11:51:31AM -0500, Patrick R. Michaud wrote:
> > It can also be that the parent directory once had a lot
> > of files/directories in it, even if it now does not.  

Yes. you are right.


> > 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).

I have a question about this.
Actually,  It was 100% full. and I spend a long time to delete the garbage files, it become to 30% full (which is what I have now).
This make me wonder why do I still such big size of the directory.

> > 
> > 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
> 
> If you do not understand hardlinks, and reference counts, and file
> reaping, and the implication of cwd/pwd, then I would not try to fix the
> problem you have, especially the way I describe below.
> 
> Really, one should never take any corrective action that one doesn't
> understand.  However...

it is root directory, can it be done per your suggestion below? ok to try?
 

> 
> While all of Patrick's warnings about mount points,etc. are still valid,
> if there are no mount points, but you are concerned about unexpected
> file access by applications:
> 
> cp -al original new; mv original original.old; mv new original
> 
> This create a tree of directories containing hard links for the files
> and identical soft links for the softlinks.  A process can grab either
> a file in original or a file in new and it has the same file.
> 
> Then, after a while, you run:
> 
> lsof original.old
> 
> to see if any of the files/directories in the original tree are in use.
> 
> When they are finally not in use, you can delete the original.old
> directory.
> 
> 
> -- 
> 
> Wayne Walker
> wwalker at solid-constructs.com
> (512) 633-8076
> Senior Consultant
> Solid Constructs, LLC
> 
> _______________________________________________
> http://www.ntlug.org/mailman/listinfo/discuss
 		 	   		  


More information about the Discuss mailing list