Is It okey to telete trash only from hosting filesystem?


The users have more files in Trash. I want to delete those files in bulk. Can I telete the trashes only from hosting filesystem? Then will data Nextcloud database okey?

D. K.

The best way to clean up deleted files is to automate the function in your config file. Simply insert the following line into your config:

'trashbin_retention_obligation' => 'auto, 14',

This will delete all trashed files when the bin is full or when files have been in the bin for the specified number of days; whichever comes first.

You will have to restart your webserver to have the changes take place.

1 Like

This will cause issues in DB, use command for this, as per docu

sudo -u www-data php occ trashbin:cleanup

You can even do this for particular users.

Both approaches do the same thing but the ‘trashbin_retention_obligation’ automates it across all uses.

I run three production Nextcloud servers and found that users were moving GBs of archived data onto NC and then deleting it which caused the storage to increase significantly. This is the only way I can keep it under control.

They should not goes over 50% of given quota with trash-bin…

Ok if we talk about approach, then from my point of view setting 'auto, 14' is quite rough to users, I would rather set it to default setting 'auto', this is more user friendly and “keeps files and folders in the trash bin for 30 days and automatically deletes anytime after that if space is needed (note: files may not be deleted if space is not needed).”

Or more even user friendly will be '14, auto' to keep files 14 days and then delete if needed.

I agree that if the NC server has storage room there is no reason to automatically delete files. But this approach ignores the trashbin’s impact on the size of backups.

My issue is that one of the corporate servers I maintain has 240GB of data on it and taking rolling backups requires at least 4X that much storage. If I don’t limit the the trashbin then it will consume the trashbin size X4 on my backup media. I am already carrying 1TB of backup data from that one server so any additional GBs in the trashbin is meaningful.

Another fundamental organizational question is “what is the trashbin for?” It should not be just another folder of last resort to hold deleted files that may be of use in 6 months. If it is trash it should be disposed of.

1 Like

I use restic to perform backups and my daily backup size is even smaller (about 500 GB) than whole data folder (about 700 GB), because of compression and hardlinks to the same and unchanged files. Check out, there few posts about it, e.g. this one Question for backup and restore - #3 by Reiner_Nippes

Also I find out that there is a lot of redundant data:

And I can reduce used space with rdfind -makehardlinks true, or this script to exclude e.g. appdata_* from it:

Thanks for the info. I’ll look at your suggestions and maybe make some changes to my backup routine.

I use a simple sudo tar -czvf' for backing up the various servers. It’s slow and simple but does the job. It also makes extraction easy when rebuilding.

  • Reboot of server maybe unreal, because the web page is on multihosting of web-provider (I’m not technical admin of web-server).
  • Auto doesn’t must work (real disk size > hosting web-page dir).
  • The shell access doesn’t work – web-page dir is over NFS (another absolute path in shell and real web (as in config file of Nextcloud) – I don’t can set the right parameter for PATH of web-page dir.