I know, that when I create empty catalog it has his own size:
mkdir test && du -h test
gives:
4,0K test
But this case is another. I had catalog with 1e6 files (74 GB) on external HDD (ext4). I processed these files, saved in other catalog and deleted from this location in parallelized script. Now this catalog should be empty. So it is ok that
ls -a raw/all
. ..
But
du -h raw/all
gives
19M raw/all
Without -h
we have exactly 19288B. And this is also strange result:
ls -la raw/all
total 19292
drwxr-xr-x 2 daniel daniel 19746816 wrz 18 19:23 .
drwxrwxr-x 4 daniel daniel 4096 wrz 17 13:21 ..
What is going on? Is there any cache in du
command? Or after processing such many files there are any rest after these files? I deleted filed by unlink
in perl5 script.
Update - answers to questions from comments
ls -aiR raw/all
raw/all:
51647758 . 51647760 ..
lsof +L1
prints 44 lines but nothing connected with this catalog. But lsof
gives something with numbers like 19746816
.
lsof | grep raw
bash 5355 daniel cwd DIR 8,17 19746816 51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all
lsof 5677 daniel cwd DIR 8,17 19746816 51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all
grep 5678 daniel cwd DIR 8,17 19746816 51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all
lsof 5679 daniel cwd DIR 8,17 19746816 51647758 /media/daniel/f2971ccd-4841-4da3-8ce3-d9f2cc03fc27/daniel/pro/scraper/raw/all
Laptop was rebooted. External drive was disconnected. But du
still shows 19M
.
ls -aiR raw/all
(https://askubuntu.com/questions/15419/how-to-list-all-the-files-in-a-tree-a-directory-and-its-subdirs) – Redbob Sep 18 '17 at 18:12sync
if that changes the size reported bydu
. Also any chance some file(s) are help open and can't be fully removed? Maybe checklsof
for open files?lsof +L1
to list open deleted files, found here: https://serverfault.com/questions/232525/df-in-linux-not-showing-correct-free-space-after-file-removal#232526 – virullius Sep 18 '17 at 19:00ls -a
(part of the suggestion in Redbob's comment) – sudodus Sep 21 '17 at 10:10ls -a
output in my question. – Daniel Sep 21 '17 at 10:16