Find and Delete Ghost Files in Nextcloud¶
Info
This guide was written by @jdaviescoates in post forum.cloudron.io/post/110118
Motivation¶
If you're seeing way more disk space used than expected in your Nextcloud app (33 GB used but 177 GB occupied etc.), here are some terminal commands you can run inside the app to identify and clean up ghost files, previews, app caches, and more.
You will need to open the Web Terminal of your Nextcloud app.
Or use the cloudron exec --tty --app $APPID command to get an interactive shell in your local terminal.
Check Overall Disk Usage¶
See how much disk space is used by Nextcloud's data directory.
List Folder Sizes in /app/data¶
This shows usage per user/app folder so you can spot what's bloating.
Clean Common Space Hogs¶
1. Delete Preview Cache (safe to delete)¶
You can regenerate them later as needed.
2. Delete Old File Versions & Deleted Files¶
If that doesn’t clear enough, nuke them manually:
3. Clear Unused App Data (e.g. SnappyMail)¶
Warning
Make sure your email is stored elsewhere (e.g. Cloudron mail server) before deleting.
If you’re not using the built-in SnappyMail app and use external email instead:
Reindex Files After Cleanup¶
This updates Nextcloud’s file index to reflect the actual files on disk.
Disable or Remove Unused Apps¶
If not using an app, stop it from consuming space:
Bonus: See Per-User File Usage¶
These steps helped me recover over 50 GB of space (from 142 GB → 87 GB) just by clearing previews and unused mail cache. Hopefully they help you too!
Let me know if you spot anything else that tends to grow quietly.