NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
JMehring
Sep 29, 2013Apprentice
Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a 314?
The older 4.x version of the OS allowed a Recycle Bin when using CIFS. Is this possible on the new OS 6.1.2? I noticed a recycle.conf file in '/data/._share/media' containing: 25000,0
JMehring
Nov 20, 2013Apprentice
davexyz wrote: Thanks JMehring
I will set this up in my NAS
Your Welcome!
Let me know if you have any issues since it was some time ago I did this.
Just a few other notes:
- only add the extra configuration options per section I listed in post above as they will get appended to original sections
- I am not sure if the old 'Recycle Bin' script that automatically deletes items in 'Recycle Bin' is still hanging around in OS6. If it is be warned that items may start to disappear if you do not have the script configured properly. You can always name 'Recycle Bin' to something like .trash if you are concerned about this.
- If you want items in 'Recycle Bin' to be automatically deleted after some time, I will provide provide a modified version of the original OS4 'clean_recycle_bins' script you can use. The original ReadyNAS one never worked correct for me and ended up deleteing things sooner than I wanted so I fixed it to work the way I expected it. You would need to add it to a cron job.
- If you play are with the clean_recycle_bins' script, I suggest you make a snap shot of the share first and keep it for a while (at least a few reboots and a few days' to make sure things are not being deleted you don't want to have deleted; also maybe make a shorter test of 5 days to test initially. BE WARNED is you modify 'clean_recycle_bins' even more and are using it with a cron job, the older version will still be in spool, so make sure its removed and using your fresh version. I got stung by this when I upgraded firmware on OS4 and since their version was broken, it always ended up cleaning out my 'Recycle Bin' early if I was not careful.
- IMPORTANT. You never know if any custom modifications you make will survive an upgrade and most likely will not survive a factory reset. So I personally create a backup of every file I manually configure, add, install, etc in a share that is backed up so I can easily replicate my changes down the road. I will show example tree layout below. This allows me to quickly see which files need to be modified, changed etc if I do a factory reset and I always check after a firmware upgrade:
/data/backup/00_ReadyNAS_OS6/NOTES.txt
/data/backup/00_ReadyNAS_OS6/00_THINGS_TO_RESTORE_ON_UPGRADING/bitcasa_0.9.6.99_amd64.deb
/data/backup/00_ReadyNAS_OS6/00_THINGS_TO_RESTORE_ON_UPGRADING/restore_apt_packages.sh
/data/backup/00_ReadyNAS_OS6/etc/frontview/samba/addons/addons.conf
/data/backup/00_ReadyNAS_OS6//etc/frontview/recycle.conf
/data/backup/00_ReadyNAS_OS6/frontview/bin/clean_recycle_bins
/data/backup/00_ReadyNAS_OS6/root
/data/backup/00_ReadyNAS_OS6/etc/init.d/bitcasa
/data/backup/00_ReadyNAS_OS6/etc/init.d/Xvfb
/data/backup/00_ReadyNAS_OS6/etc/passwd
/data/backup/00_ReadyNAS_OS6/etc/group
/data/backup/00_ReadyNAS_OS6/apps/<BACKUP of all apps in /apps directory>
Here is the modified 'clean_recycle_bins' script that used to live in '/frontview/bin/clean_recycle_bins' on OS4:
#!/usr/bin/perl
#-------------------------------------------------------------------------
# Copyright 2007, NETGEAR
# All rights reserved.
#-------------------------------------------------------------------------
use lib qw( /frontview/lib );
use Frontview;
my $fv = new Frontview;
$fv->Account_get_info();
$fv->Service_get_info();
open(IN, "/etc/frontview/recycle.conf") || exit;
my = <IN>;
close(IN);
#if( $fv->{Service}{USER_HOME_DIRECTORY} &&
# $fv->{Service}{USER_HOME_DIRECTORY_RECYCLE} )
#{
# my $path;
# my $recycle_max_days = $fv->{Service}{USER_HOME_DIRECTORY_RECYCLE_MAX_DAYS};
# $recycle_max_days = $HOME_RECYCLE_AGE_LIMIT if( !$recycle_max_days );
# my $recycle_max_size = $fv->{Service}{USER_HOME_DIRECTORY_RECYCLE_MAX_SIZE};
# $recycle_max_size = $HOME_RECYCLE_MB_LIMIT if( !$recycle_max_size );
#
# printf("Max Days: %s\n", $recycle_max_days);
# printf("Max Size: %s\n", $recycle_max_size);
# printf("dirlist: \n\n");
#
# foreach my $user( sort keys %{ $fv->{Account}{user} } )
# {
# printf("user: $user\n");
# if( -d "$fv->{Account}{user}{$user}{home}/Recycle Bin" )
# {
# $path = $fv->{Account}{user}{$user}{home};
# printf("Path: %s\n-----------------------------------------------\n", $path);
# push , "$user!!$path!!$recycle_max_size!!$recycle_max_days";
# }
# }
#}
printf("dirlist: \n\n");
chomp;
printf("dirlist: \n\n");
foreach ()
{
chomp;
my ($share, $path, $mb_limit, $age_limit) = split('!!');
printf("Share: %s\n", $share);
if( $age_limit )
{
printf("Age Limit: %s\n", $age_limit);
system("find '$path/Recycle Bin' -type f -ctime +$age_limit -exec rm -rf {} \\; &>/dev/null");
}
if( $mb_limit )
{
printf("MB Limit: %s\n", $mb_limit);
my $recycle_mb = `du -sm '$path/Recycle Bin' 2>/dev/null`; chomp $recycle_mb;
if( $recycle_mb > $mb_limit )
{
my %files;
open(FIND, "find '$path/Recycle Bin' -type f -printf '%p!=!=%C@!=!=%s\n' |");
while(<FIND>)
{
chomp;
my ($name, $time, $size) = split('!=!=');
while( exists $files{$time} )
{
++$time;
}
$files{$time}{name} = $name;
$files{$time}{size} = $size;
}
close(FIND);
my $total_size = 0;
my $byte_limit = ($mb_limit * 1024 * 1024);
foreach my $time (reverse sort keys %files)
{
$total_size = ($total_size + $files{$time}{size});
if( $total_size > $byte_limit )
{
unlink("$files{$time}{name}") or system("rm -f \'$files{$time}{name}\'");
}
}
}
}
# Do a reverse sort so we can rmdir child directories before the parents.
open(FIND, "find '$path/Recycle Bin' -type d 2>/dev/null | sort -r |");
while(<FIND>)
{
chomp;
rmdir;
}
close(FIND);
}
close(IN);
And here is an example 'recycle.conf' file that used to live in '/etc/frontview/recycle.conf' on OS4. This example cleans out the 'Recycle Bin' in the share 'media' after stuff is over 360 days old and in 'media-other' after files are over 180 days old and will allow the 'Recycle Bin' to grow to any size.
media!!/c/media!!0!!360
media-other!!/c/media-other!!0!!180
Related Content
NETGEAR Academy

Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!