Is there a way to force the trashbin to delete files over 30 days regardless of the space available in the user’s quota ?
occ command has functions for cleaning and expiring trash:
occ help trashbin:cleanup and
occ help trashbin:expire you could use them together with a systemd timer job to run them every 30 days, e.g. on the 1st of every month. However, this would of course not only delete files that are 30 days old, but also files that have been deleted one day before. So maybe only a suboptimal solution.
Yes I could but it’s not exactly the aim. I just want to keep 30 days of trashbin no matter the user quota.
I could reduce the quotas once in a while but I have over 100 users…
The configuration option you are looking for is described here:
Thanks for the link but this only applies if the deleted files are taking over 50% of the user quota. So if I have a user with 1 To quota using 300 Go his trashbin is never emptied.
auto, D? That looks like the correct configuration for your use case. If I read it correctly, it says:
delete all files in the trash bin that are older than D days automatically, delete other files anytime if space needed
The first rule looks independent from the need of space, doesn’t it? In comparison to
D, auto, which both say:
(note: files may not be deleted if space is not needed)
I guess, this limitation is left out with purpose in the description
auto, D. Which makes sense, as the second value is always an upper bound, which makes it a hard limit if something else than
auto is the second value.
Have you tried that already? If it doesn’t work, I’d argue the documentation is ambiguous.
My config.php holds
trashbin_retention_obligation' => '25, 30',
And I still have files in the trashbin that are over 2 months old…
I think the quota must configured with trash. But perhaps you can send all users an email to delete the trash regularly.
It would make sense that the trashbin_retention_obligation did not care about your quota state. I don’t get this 50% limit trigger
This line works.
But i don’t why it need some magics to apply.
Reboot the server, do a occ command for cleanup …
But i have the same line and it works for me now.
In my case it’s ‘60, 90’
It does work but only if you exceed 50% of your quota. I tested it by reducing the quota on one account and it did clear the trash correctly
For me it works but i don’t have quota, am i unlimited quota.
So if you have 100GB quota and use only 5GB maybe this line won’t work…
in this case it’s sad and need to get address to the devs.
The options are weird, some just don’t make any sense, the descriptions are weird, and it doesn’t work like advertised. It’s a mess, tbh.
OK, let’s take them aone after the other:
- “auto”. This one would make sense, if it would work. However, my partition is full with 125GB, I’m using only 14GB, the trashbin is full of files older than 4 months. So clearly not deleting for need of space nor for age.
- “D, auto”. Clearly doesn’t make sense. It deletes, quote, “anytime” when space needed, so wouldn’t respect the D in that case. Respects D intrinsically, when space is not needed. Doesn’t do anything automatically after D. The D in that list seems useless. It’s possible though the D is a strict minimum and the “anytime” is wrong wording.
- “auto, D” - similar to auto if set to “auto, 30”, albeit with enforced deletion after 30d. Therefore would make sense if it worked. I’m trying this out atm.
- “D1, D2” clearly doesn’t make sense. Deletes after D2, doesn’t do anything different for before and after D1. D1 in that list even less (potentially) meaningful as D in “D, auto”.
- “disabled” well, that one is clear. On my system, it seems to be active. Maybe it’s the true default.
If some of these options only work with quotas, it should clearly say so. The “when needed” part may rely on that. Though I wouldn’t know why a maximum retention setting should only work with quotas.
So the documentation is wrong and/or incomplete, and some of the options don’t make sense, and/or it doesn’t work like configured and advertised. Could be a useful app, the trashbin retention is one of the features I advertise Nextcloud with. (It may not sound like it, but I’m, in general, happy with Nextcloud. However, the Trashbin keeps blowing up, and that is somewhat painful.)
I agree with you that the description is weird.
Did anybody get the trash expiry working without user quota settings? To me it seems that the available disk space is ignored completely!
In my experience, “auto, 30” does reliably do the deletion after 30 days. “auto” seems to rely on a quota and therefore wouldn’t be applied at all if there is none. If we take the introductory wording, “two settings, a minimum time for trash bin retention, and a maximum time for trash bin retention” and take the quota as a requirement for the “auto” part, insert some “after that” and strike some "anytime"s, we arrive at a partially useful set of settings. Still not sure what “D1, D2” is supposed to achieve though. A short test seems it achieves deletion after D2 days. It should be independent of quota, the docs suggest (there doesn’t seem to be an “auto” component).
auto : Without quota, does nothing.
D, auto : Without quota, does nothing.
auto, D : Without quota, deletes after D days.
D1, D2 : Deletes after D2 days.
I was able to clean the trash with following steps:
- added " ‘trashbin_retention_obligation’ => ‘auto, 30’, " to config.php
- restarted the docker container just for sure
- run “update oc_jobs set last_run=0” to database
- run sudo -u www-data php ./cron.php in nextcloud container, and it finally deleted all the old trashed files.