Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  11] [ 0]  / answers: 1 / hits: 2813  / 2 Years ago, tue, november 30, 2021, 4:56:55

This does not make any sense!



user@localhost:~/folder$ du -h --max-depth=1
6.1M ./subfolder
6.1M .
user@localhost:~/folder$ ls -la subfolder
total 6228
drwx------ 2 user user 6369280 2013-07-08 16:03 .
drwx------ 9 user user 4096 2013-07-08 16:04 ..


du reports 6.1 megabytes, ls reports a total of "6228" (I don't know total of what)... but the folder is empty... indeed, there is no file there and it should be empty indeed.



Why is that? Can someone explain this to me?



This is happening in a VPS running Ubuntu 10.04



Thank you.


More From » disk-usage

 Answers
6

You're looking at a result of how Ext2/3/4 filesystems work. The list of files (inodes) in the directory is kept as the directory 'file', represented as the . in the listing. After removing the files in the directory, the disk usage does not shrink.



Therefore, I assume you had a lot of files in the directory before (or you're omitting them in the ls output in your question). The only solution is to remove and recreate the directory to free up this space.



See also: Why could the size of the “dot file” /. exceed 4096?



For as to what the total 6228 means, see ls command: what does the first line mean?


[#30395] Thursday, December 2, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
motivengry

Total Points: 459
Total Questions: 112
Total Answers: 108

Location: Bonaire
Member since Sat, May 1, 2021
3 Years ago
motivengry questions
Tue, Oct 4, 22, 10:02, 2 Years ago
Wed, May 31, 23, 14:33, 12 Months ago
;