[Samba] vfs_recycle folder limit management

Kevin Field kev at brantaero.com
Thu Sep 26 08:24:06 MDT 2013

On 2013-09-26 10:20 AM, Taylor, Jonn wrote:
> On 09/26/2013 08:47 AM, Kevin Field wrote:
>> Hi all,
>> Running SerNet Samba 4.0.9 on CentOS 6.4 serving as an AD DC and
>> fileshare for XP clients.
>> Added recycler per the example at
>> https://wiki.samba.org/index.php/Frequently_Asked_Questions to my
>> smb.conf.  Works great.
>> My concern is that the recycle dir will eventually grow large.
>> vfs_recycle's docs mention a parameter for limiting individual file
>> sizes, but what's a best practice to prevent the whole recycle folder
>> from growing too large?  Cronjob to delete old files when the total is
>> past a certain size?  Anyone have a script handy?  (I'm hoping I'm not
>> the only one with this problem :) Seems like it would be a common
>> concern...)
>> Thanks,
>> Kev
> I use a script to cleanup the deleted files and run it daily with cron.
> cat /usr/bin/cleanupold
> #!/bin/bash
> find /var/share/.recycle/* -mtime +30 -exec rm {} \;
> In /var/spool/cron/root
> @daily    /usr/bin/cleanupold > /dev/null 2>&1 #Cleanup old audio files
> Jonn

Thanks John, but I meant more so is there a way to have it look at the 
total size of the recycle dir too?  I.e. only delete stale files when it 
needs to to stay within a limit, and also even delete not-so-stale files 
if it needs to because there have been too many GB deleted lately to 
keep 30 days worth (or whatever) around?

Thanks again,

More information about the samba mailing list