33 GB of usage, 177 GB system space occupied - how to find ghost files?
-
root@258e2da2-ade7-441e-a8b2-11897f7d8acf:/app/code# sudo -u www-data php -f /app/code/occ files:cleanup 0 orphaned file cache entries deleted 0 orphaned file cache extended entries deleted 0 orphaned mount entries deleted
This also didn't help. Recreating the index for all users also doesn't bring any change in the calculated used space.
@jayonrails have you checked Jay's Nextcloud trash/ deleted files?
-
Thanks for your suggeestions, deleted files is empty on all users.
-
Hi,
I am running the following setup:
- Cloudron v8.2.4
- Nextcloud package com.nextcloud.cloudronapp@4.23.4
There are a few users in Nextcloud, using 33 GB in total storage if you add up the usage that is shown at //settings/users
When I open up Cloudron system information and let it calculate the disk usage, it shows me that Nextcloud is using 177.08 GB of storage on the Cloudron server.
When running
sudo -u www-data php -f /app/code/occ files:scan jay
I get the following output:
root@258e2da2-ade7-441e-a8b2-11897f7d8acf:/app/code# sudo -u www-data php -f /app/code/occ files:scan jay Starting scan for user 1 out of 1 (jay) +---------+-------+-----+---------+---------+--------+--------------+ | Folders | Files | New | Updated | Removed | Errors | Elapsed time | +---------+-------+-----+---------+---------+--------+--------------+ | 233 | 6319 | 0 | 6547 | 0 | 0 | 00:00:09 | +---------+-------+-----+---------+---------+--------+--------------+
User "jay" is the only one having more than just a few KB of files.
I remember that some file uploads to the Nextcloud system failed a few months ago and I think these might be still stored somewhere, where the application cannot find it, but still take space.
How can I find those?
Best
Jay@jayonrails said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:
I remember that some file uploads to the Nextcloud system failed a few months ago and I think these might be still stored somewhere, where the application cannot find it, but still take space.
I was right on this one. I downloaded all the files that are present on the Nextcloud, deleted all the servers on the web interface and then re-synced from my computer. The ghost files are gone, it is now using around the 33 GB as I would have expected it.
Nextcloud is great tool, but sometimes does weird things. This is one example of being weird.
The issue is resolved for now, thanks for your ideas on it.
-
@jayonrails said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:
I remember that some file uploads to the Nextcloud system failed a few months ago and I think these might be still stored somewhere, where the application cannot find it, but still take space.
I was right on this one. I downloaded all the files that are present on the Nextcloud, deleted all the servers on the web interface and then re-synced from my computer. The ghost files are gone, it is now using around the 33 GB as I would have expected it.
Nextcloud is great tool, but sometimes does weird things. This is one example of being weird.
The issue is resolved for now, thanks for your ideas on it.
@jayonrails good one!
Out of interest I asked ChatGPT where partially uploaded files might be within Nextcloud and the advice it gave was:
- Delete files in /data/<user>/uploads/
- Clear /data/tmp/
- Remove .part files
- Fix database with occ files:scan --all
- Run occ files:cleanup to remove orphaned files
-
I facing this issue now too. My users are using about 90GB but Cloudron says it's nearly 160GB (and that's after deleting all my deleted items). I'm struggling to find the 70GB of ghost files so I can remove them!
-
π§Ή 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
but177 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.
-
π§Ή 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
but177 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.
@jdaviescoates said in 33 GB of usage, 177 GB system space occupied - how to find ghost files?:
π§Ή How to Find and Delete Ghost Files in Nextcloud (Cloudron)
This should be a stickied post. Thanks for sharing!
-
Yeah. @staff I imagine this is quite a common issue - perhaps make it a Guide/ add it to docs?