LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 09-19-2012, 10:11 AM   #1
Fishbowler
LQ Newbie
 
Registered: Sep 2012
Location: Nottingham, UK
Distribution: Linux Mint
Posts: 7

Rep: Reputation: Disabled
Why is du high for an empty directory?


I've been moving a lot of files around today, and come across a peculiar situation where an empty folder has a high reported disk usage.

du -b gives:

Code:
4096    ./FolderOne
4096    ./FolderTwo
36864   ./FolderThree
229376  ./FolderFour

ls -R gives:

Code:
.:
. .. FolderOne FolderTwo FolderThree FolderFour

./FolderOne:
. ..

./FolderTwo:
. ..

./FolderThree:
. ..

./FolderFour:
. ..
ls -aR gives the same, but more verbosely. The sizes are proportional to the amount of files that were in them previously. This is on an ext3 drive.

Any ideas what's going on?
 
Old 09-19-2012, 10:29 AM   #2
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,758

Rep: Reputation: Disabled
Did you change mount options?

diratime?

fsck and report
 
Old 09-19-2012, 05:16 PM   #3
jefro
Guru
 
Registered: Mar 2008
Posts: 11,552

Rep: Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406Reputation: 1406
Wonder what ls */ says?

Last edited by jefro; 09-19-2012 at 05:17 PM.
 
Old 09-19-2012, 06:06 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,978
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
And there's always the obvious question: did you remove a file that process
was still writing to?

lsof | grep FolderFour


Cheers,
Tink
 
Old 09-20-2012, 01:29 AM   #5
Fishbowler
LQ Newbie
 
Registered: Sep 2012
Location: Nottingham, UK
Distribution: Linux Mint
Posts: 7

Original Poster
Rep: Reputation: Disabled
Thanks to all for the suggestions.

Mount options are unchanged. I can post my fstab if it helps?

Ran a boot time fsck but the problem still exists. Is there a log file I should be looking at? Google reckons /var/log/messages, but that file doesn't exist on my system. I have /var/log/fsck/checkfs and /var/log/fsck/checkroot, but they haven't been modified since October '11. I'm running Mint 12.

ls */ gives:
Code:
FolderOne/:

FolderTwo/:

FolderThree/:

FolderFour/:
lsof | grep FolderFour gives nothing.

Any more ideas?
 
Old 09-20-2012, 05:36 AM   #6
Fishbowler
LQ Newbie
 
Registered: Sep 2012
Location: Nottingham, UK
Distribution: Linux Mint
Posts: 7

Original Poster
Rep: Reputation: Disabled
Here's the line for the drive from /etc/fstab:
Code:
/dev/disk/by-uuid/f0fc5b1c-0d97-47f2-995d-0d4bc3c23531      /media/DATA3   ext3    auto,user,exec,rw 0 2
 
Old 09-20-2012, 09:28 AM   #7
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,437

Rep: Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599
What is the size of the directory itself (ls -ld FolderFour)? If that directory once contained a large number of file names, the directory file itself will be large, and a directory file never shrinks.
 
Old 09-20-2012, 09:59 AM   #8
Fishbowler
LQ Newbie
 
Registered: Sep 2012
Location: Nottingham, UK
Distribution: Linux Mint
Posts: 7

Original Poster
Rep: Reputation: Disabled
ls -ld shows the same size as above - 229376.
Looks like a feature of ext filesystems.

Thanks for your help!
 
Old 09-20-2012, 12:19 PM   #9
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: CentOS
Posts: 1,437

Rep: Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599Reputation: 599
As pointed out in the referenced thread, the only way to reduce that size is to delete the directory and re-create.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
rm: cannot remove directory `ff': Directory not empty blancs Linux - General 17 08-29-2011 01:47 PM
Empty a directory fhsm Linux - Newbie 3 04-16-2009 11:19 PM
The postgresql data directory content in the pgsql directory is lost (empty data dir) kisembo Linux - Software 1 02-13-2006 01:11 PM
Empty directory contents stefaandk Linux - General 1 08-22-2005 07:03 AM
How to check if a directory is empty? Aziz Linux - Software 2 09-27-2004 04:46 PM


All times are GMT -5. The time now is 07:27 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration