× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a 314?

JMehring
Apprentice

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
Message 1 of 23
evan2
NETGEAR Expert

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

There is not Recycle Bin on 6.1.2 which utilize btrfs' snapshot feature so that user can revert any point of time from snapshots.
Message 2 of 23
DeeCee521
Aspirant

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a 314?

Hmmm......I started out on 6.0 and I did migrate data from an Ultra 4+, which had a recycle bin. It still seems to be functioning even though I have upgraded up to and including 6.1.3. Now both recycle bin and snapshot have been difficult to backup on an older nV+. I think I have been able to configure both / and, one or non using the web interface but it silk may not be functioning correctly.

Sent from my GT-N8000 using Tapatalk 4
Message 3 of 23
JMehring
Apprentice

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

I did get Recycle Bin working on 6.1.4, but had to manually edit some configuration files to make it work.

If anyone is interested, I will tell you how I did it.

EDIT.

The reason I want Recycle Bin and not use snapshots to restore previous versions is because I don't want the files actually deleted; I still want them accessible.

I use Plex Media Server to manage my content. When I am finished watching a tvshow, etc I delete the show and then it is moved into Recycle Bin. Other family members have the Recycle Bin as a source for their media sections. That way even though I deleted the file, it is still available for others to view. Then every few months I go ahead and permanently delete the media files in Recycle Bin that have been viewed by others.
Message 4 of 23
davexyz
Aspirant

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Hi JMehring

I also would like to have Recycle Bin rather than snapshot on 6.1.4 can you post info on what to do step by step

That would be great
Message 5 of 23
JMehring
Apprentice

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

What I did was created this File:

/etc/frontview/samba/addons/addons.conf
-rw-r--r-- 1 admin admin 556 Nov 6 00:43 addons.conf


Then I edited it to include 2 of my existing shares that I want to have 'Recycle Bin' bin enabled:

[bitcasa]
vfs objects = recycle
recycle:repository = Recycle Bin
recycle:keeptree = yes
recycle:versions = no

[media]
vfs objects = recycle
recycle:repository = Recycle Bin
recycle:keeptree = yes
recycle:versions = no


Now you need to reload the config file. The only way I could figure out how to do this was go to the frontview web interface -> Shares and edit one of your current shares changing something so when you press OK, it will reload config file (I just kept toggling ftp on and off when testing).

Then, just run:

testparm


It should list all your shares and show the recycle: parameters for the sections you wanted.

Note, I use the name 'Recycle Bin', but you could choose another like '.trash'
Message 6 of 23
DeeCee521
Aspirant

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

I just realized that my recycle bins are disappearing one by one. I have the snapshots. It would be nice if you could choose at set up.

Swyped from my Galaxy Nexus using Tapatalk 4
Message 7 of 23
davexyz
Aspirant

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Thanks JMehring

I will set this up in my NAS
Message 8 of 23
JMehring
Apprentice

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

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
Message 9 of 23
davexyz
Aspirant

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

WOW

You have looked at this

I have "installed" the Recycle Bin in my Nas Just what I wanted . I have simple requirements for my NAS and snapshots were not necessarily the best option for me. It even works on attached usb drives. This is the way I use my NV+ V1 and NV+V2.


Brilliant

Thanks once again for this
Message 10 of 23
prix57
Guide

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Hello can this recycle bin also be added on a RN 104?
Message 11 of 23
JMehring
Apprentice

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

I would assume so 🙂
Message 12 of 23
prix57
Guide

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

ok, dumb question.
how do you access the config file on a RN 104 so you can apply the recycle bin config file?
Message 13 of 23
StephenB
Guru

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Select system, then the settings tab. The top section lists services, ssh is one of them. You need to enable that. Then use putty (or equivalent) to access the NAS. Logon is root, the password is your NAS admin password.

An alternative is to download the config settings (zip file) to your PC, make the change in the zip file, and then upload the new configuration. The config backup/restore is also on the settings tab.

Either way the files need to use the linux formatting convention, which is not compatible with a PC. One way to preserve the formatting is to use a freeware editor called notepad++ (http://notepad-plus-plus.org/). DON'T use notepad or wordpad on your PC - it is possible to brick your NAS if you use the windows format.
Message 14 of 23
prix57
Guide

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

@ StephenB thank you so much for the info!
Message 15 of 23
prix57
Guide

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

How do I actually create this config file on the NAS?

Do I just download the config settings (zip file) to my PC, create a new sub folder under /etc/frontview/samba/ called "addons" and in there create new config file "addons.conf"?

Wouldn't there be an issue creating the folder and files via windows?

How do I actually create the config file via command line?

When I connected to my RN104 via putty I dont see the samba subfolder under /etc/frontview.
Message 16 of 23
JMehring
Apprentice

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Use something like putty if coming from Windows to ssh into your NAS. If you need help on how to enable ssh I think there are a few threads on that.

As far as I know, the samba directory should be already present, even in the last version located at:
'/etc/frontview/samba'. If the 'addons' directory does not exist, create it.


cd /etc/frontview/samba
ls -l
# If addons directory does not exist, create it
mkdir addons
cd addons

# Create/edit the addons.conf file and add configuation information as incicated in the earlier post
vi addons.conf


If you need help using 'vi', search google; here is one of the links I found: http://www.howtoforge.com/faq/12_15_en.html

I have succussfully been using this technique with 6.1.2 to the latest 6.1.8

EDIT:

You stated that the '/etc/frontview/samba' directory does not exist for you. I am thinking it should be there since it hold many of the samba configuration files like:

cd /etc/frontview/samba
ls -l

total 36
drwxr-xr-x 1 admin admin 22 Mar 31 23:36 addons
-rw-r--r-- 1 admin admin 0 Jun 5 13:19 dfs.conf
-rw------- 1 admin admin 5585 Jun 5 13:19 Shares.conf
-rw-r--r-- 1 admin admin 303 Jun 5 13:16 Shares.conf.admin
-rw-r--r-- 1 115 guest 14 Jun 1 2013 smb.conf.CIFSFS
-rw-r--r-- 1 115 guest 599 Jun 1 2013 smb.conf.defaults
-rw-r--r-- 1 115 guest 32 Jun 1 2013 smb.conf.OS2
-rw-r--r-- 1 115 guest 84 Jun 1 2013 smb.conf.OSX
-rw-r--r-- 1 115 guest 14 Jun 1 2013 smb.conf.Samba
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.UNKNOWN
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.Vista
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.Win2K
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.Win2K3
-rw-r--r-- 1 115 guest 18 Jun 1 2013 smb.conf.Win95
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.WinNT
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.WinXP
-rw-r--r-- 1 115 guest 0 Jun 1 2013 smb.conf.WinXP64
Message 17 of 23
prix57
Guide

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Yes JMehring you are right I did find the samba directory in "/etc/frontview/samba".

I went ahead created addons.conf file and edited it via VI to add the recycle bin config.

I tested it and the recycle bin is there now and works! Thank you so much for all your help!

Just one question though.

When you delete items from the NAS, in order for them to go to the recycle bin can they only be deleted via the readynas web interface? When I delete items via windows explorer on the NAS it always asks to permanently delete (thus not going to the recycle bin), but when I delete the files via the readynas web interface when browsing to the shares the recycle bin works.

Is there a way to have files deleted via windows on the NAS go to the recycle bin setup?
Message 18 of 23
JMehring
Apprentice

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Did you try rebooting windows after applying the recycle bin configuration? It should work no matter what OS you are using since it is the samba/cifs share doing the work.

Personally I can not test this out since I do not have windows
Message 19 of 23
prix57
Guide

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

I stand corrected it does work via windows as well.
Message 20 of 23
Sandshark
Sensei

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a

Actually, Windows is ignorant of the NAS recycle bin, so even things deleted where you tell it not to go to recycle bin will go there on the NAS. You also cannot "empty the recycle bin" in standard Windows fashion. You have to go into the bin and delete the files. Note that also applies to things deleted by your virus checker, which can be a good thing for false virus ID's but bad for real infected files.
Message 21 of 23
SuperNASman
Aspirant

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a 314?

Is there any updated information about enabling Recycle Bin on OS 6? Specifically OS 6.2.4 on a ReadyNAS Pro 2.

 

What the hell kind of developer thinks it is a good idea to remove useful functionality in exchange for less useful functionality?

 

I can't choose when snapshots are taken, I can't take multiple combinations of Snapshots like Hourly and Weekly, and Snapshots provide much less protection against accidently deleted files than the Recycle Bin does.

 

I just wanted to see if there is any new guide or information on enabling Recycle Bin on OS 6.

 

Message 22 of 23
mdgm-ntgr
NETGEAR Employee Retired

Re: Can 'Recycle Bin' be enabled for CIFS and OS 6.1.2 on a 314?

You can use SSH to enable it as described earlier in the thread.

 

Snapshots make much more efficient use of space than a recycle bin and unlike with a cifs recycle bin with snapshots you can delete files using whichever protocol you want.

Seeing you have a Pro 2, you could backup your data and downgrade back to OS4: https://community.netgear.com/t5/Community-Add-ons/Downgrade-to-RAIDiator-x86-from-ReadyNAS-OS-notsu...

Message 23 of 23
Top Contributors
Discussion stats
  • 22 replies
  • 8031 views
  • 3 kudos
  • 9 in conversation
Announcements