π§Ή How to Find and Delete Ghost Files in Nextcloud (Cloudron)
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.
To open the terminal:
Cloudron Dashboard β Nextcloud β Terminal (Web Terminal tab)
Check Overall Disk Usage
du -sh /app/data
See how much disk space is used by Nextcloud's data directory.
List Folder Sizes in /app/data
du -sh /app/data/* | sort -h
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)
rm -rf /app/data/appdata_*/preview/*
You can regenerate them later as needed.
2. Delete Old File Versions & Deleted Files
occ versions:cleanup
occ trashbin:expire
occ trashbin:cleanup
If that doesnβt clear enough, nuke them manually:
rm -rf /app/data/*/files_versions/*
rm -rf /app/data/*/files_trashbin/*
3. Clear Unused App Data (e.g. SnappyMail)
If youβre not using the built-in SnappyMail app and use external email instead:
rm -rf /app/data/appdata_snappymail
οΈ Make sure your email is stored elsewhere (e.g. Cloudron mail server) before deleting.
Reindex Files After Cleanup
occ files:scan --all
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:
occ app:disable snappymail
occ app:remove snappymail
Bonus: See Per-User File Usage
du -sh /app/data/*/files | sort -h
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.