I'm having a frustrating issue with my setup on a Raspberry Pi 4. My Nextcloud and Paperless services went down due to a 503 error, and when I checked the disk space, I found my SD card is nearly full. The `lsblk -f` command shows the following: mmcblk0 has 91% used, while `du -hx --max-depth 1 / | sort -rh` reports only 7.5G used on the root directory. I've deleted some data, yet I seem to be missing about 40G. I've already checked for files that are still open after deletion, but I'm stuck on how to further investigate where this extra space is being consumed. Any tips on what could be causing this discrepancy?
3 Answers
It's quite common to have files that are deleted but still open by a process. As long as the inode is held, those blocks will still occupy space. You might want to check for any processes that have these files open using `lsof`. You can run:
lsof -nP | grep '(deleted)'
This should help you identify if there's anything lingering around that you can address.
Have you considered the possibility of sparse files? They can sometimes cause discrepancies in reported usage because they only consume space for the actual data written, not the entire allocated size. You could check this by using commands that reveal the actual disk usage of such files.
You might want to check if you accidentally mounted your SD card over a directory with existing data. If you mounted it over a directory that had files, that data is hidden but still using up the space on your SD card. Try checking the mount points or unmounting and then looking at the directories to see if there's hidden data consuming space.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures