Y
Y
Yaroslav2021-02-11 17:10:57
linux
Yaroslav, 2021-02-11 17:10:57

Where did the place in the empty directory go and how to see it?

(see the addition below, the situation has become simpler and more mysterious)

I accidentally noticed that I have one of the almost empty directories (only 5 files, the maximum file size is 254 bytes, they weigh 528 bytes in total, 8 directories) - but the du directory weighs as much as 2.8 megabytes . Root filesystem, ext4. A trifling size, but I wonder where such a wild overhead comes from? (I am aware of the cluster size, if anything, but this cannot explain the phenomenon)

[email protected]:~/locker-apps/test/users-OLD$ du -sh
2.8M	.

[email protected]:~/locker-apps/test/users-OLD$ ls -al
total 2768
drwxr-xr-x 1 xenon xenon 2813952 Feb 11 20:49 .
drwxr-xr-x 6 xenon xenon    4096 Feb 10 22:52 ..
drwxr-xr-x 5 xenon xenon    4096 Jan 15 01:39 a
drwxr-xr-x 5 xenon xenon    4096 Feb 10 22:21 b

[email protected]:~/locker-apps/test/users-OLD$ du -sh a
32K	a

[email protected]:~/locker-apps/test/users-OLD$ du -sh b
20K	b

[email protected]:~/locker-apps/test/users-OLD$ tree -h
.
|-- [4.0K]  a
|   |-- [4.0K]  r
|   |   |-- [ 254]  userinfo.json
|   |   `-- [ 254]  userinfo_create.json
|   |-- [4.0K]  rw
|   |   |-- [  10]  notebook.txt
|   |   `-- [   5]  test.txt
|   `-- [4.0K]  s
`-- [4.0K]  b
    |-- [4.0K]  r
    |-- [4.0K]  rw
    |   `-- [   5]  notebook.txt
    `-- [4.0K]  s

8 directories, 5 files


That is, the place is lost somewhere inside the users-OLD itself. Each of the two nested directories weighs little. I tried `cp -a users-OLD /tmp/` and in this case the new directory already weighs 56K (also a bit too much, but less):

[email protected]:~/locker-apps/test$ cp -a users-OLD/ /tmp/
[email protected]:~/locker-apps/test$ du -sh /tmp/users-OLD/
56K	/tmp/users-OLD/


How can you see where ~2.8Mb goes?

Addition :
Deleted both subdirectories, now I have one empty directory and it is 2.7Mb
[email protected]:~/locker-apps/test/users-OLD$ ls -al
total 2760
drwxr-xr-x 1 xenon xenon 2813952 Feb 11 22:22 .
drwxr-xr-x 6 xenon xenon    4096 Feb 10 22:52 ..
[email protected]:~/locker-apps/test/users-OLD$ du 
2756	.
[email protected]:~/locker-apps/test/users-OLD$ du --apparent-size
2748	.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
L
Lynn "Coffee Man", 2021-02-11
@xenon

Judging by the line
drwxr-xr-x 1 xenon xenon 2813952 Feb 11 20:49 .
in this directory at some point there were a lot (thousands) of files.
In ext2/3/4, a directory is such a "special file" that contains the names (and something else) of the files it contains. And if there are a lot of them, then the catalog itself will be large. But at the same time, there is no mechanism for reducing the size of the directory.
The standard option is to copy all the files from it to a new directory, delete this one and move the new one in its place.

Z
zersh, 2021-02-11
@zersh

perhaps a file was deleted from the directory that continues to hold the application?
try

lsof | grep-delete

found process - kill/restart

D
Dmitry, 2021-02-11
@dtmse

Look at the output of the command Perhaps the files in the directory have been deleted, but they are actually still in use by some application and therefore take up disk space.
lsof | grep '(deleted)'

V
Victor Taran, 2021-02-11
@shambler81

ncdu put

E
Egor Zhivagin, 2017-09-12
@tory_kuzya

Once
Here's another
stack over, if it's more convenient

A
Artur Karapetyan, 2017-09-12
@architawr

Problem due to cyrillic characters in path to gulpfile.js (Username) C:\Users\ KuziaAser \Downloads\OpenServer\domains\potokblue

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question