You are here
Psilospiral - Mon, 2020/09/28 - 16:24
Greetings Forum:
Can somebody please point me to the recycle directory settings for Turnkey Linux File Server cifs/samba shares? I've searched the webmin interface and cannot locate a setting to limit the maximum size of the .recycle directories. Is there a global size setting for all shares or a way to easily empty all share .recycle directories?
Forum:
It doesn't seem like there is an OOTB solution...
Looking at the Samba vfs_recycle man page I can't see any support for limiting the recycle bin size. There are file size limits there, although I'm not sure if they're adjustable within Webmin. If not, the config file is /etc/samaba/smb.conf and you can use the pre-installed 'nano' to edit it (it's a commandline text editor which is somewhat like Notepad).
So bottom line, I don't think that what you want is possible OOTB.
However, this is Linux, so (pretty much) anything is possible if you really want it! :)
Digging in a bit deeper, I note that it's possible to adjust the timestamps when moving to the recycle bin. There is also a tool called tmpreaper which will clean up files based on timestamp. That still doesn't meet your requirements re filesize, but using these bits, together with a function to get file tree size, we could create a (daily?) cron job to check the size of the .recycle directory and if it's over a certain size, remove files older than X days. Then recheck the file tree size and if it's still not the desired size, reduce the age filter by a day and clean again. Rinse and repeat until the .recycle directory is smaller than the desired size. So to put all this together, here is that basis of a script (perhaps save it as /usr/local/bin/recycle-cleanup?!):
Please note that I haven't tested this at all so it may requires some more tweaking. Plus I haven't described how we might set this up as a cron job. However, I've already spent more time on this than I ideally should have. So please let me know if you want to proceed and I'm happy to work with you to get this working as desired.
Greetings again Jeremy:
Greetings again Jeremy:
I like your solution and do appreciate your time throwing something together. I will play with your script more in the future - it gave me a few ideas.
I have some scripts that are triggered in crontab to automatically tar a series of vzdump (Proxmox backups) of numerous containers and virtual machines. These can get large in size and deleting the old ones over a period of time silently chewed up a noticeable amount of my pool storage! I found the culprits in my .recycle directory.
It looks like I can modify the config file and use recycle:exclude_dir to exclude the directory that I use specifically for bakcups to solve my problem. Thank you for pointing me to Samba VFS recycle man page!
Glad is was useful! :)
Glad that my ideas got you pointed in the right direction and ended up being useful; albeit in a somewhat indirect way. :)
Add new comment