Recycle Bin (vfs recycle) for SMB Shares


dlandon

794 posts in this topic Last Reply

Recommended Posts

  • Replies 793
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Popular Posts

This is a plugin that will create a per share .Recycle.Bin folder on each smb share for files deleted on that share.  Built into samba is a module called "vfs recycle" that handles the deletion of fil

Shares were not displaying when "Log Deleted Files" was set to "No".  This has been fixed in the latest version.

No longer true.  I'm releasing a new version that will not show any remote mounted shares and the local recycle bin will not remove any files from the remote share recycle bins.  Only the local server

Posted Images

15 minutes ago, wgstarks said:

Ok. Thanks.

Where would I need to store the placeholder.txt file for this to work?

 

That command will do what you need.  It creates the file in the recycle bin.  The command puts an empty string into a newly created file in the .Recycle.Bin folder.

Edited by dlandon
Link to post
  • 3 weeks later...
2 hours ago, Lacehim said:

Have a look under view in explorer and check or uncheck the hidden files should solve it.

 

Windows is set to not show hidden folders. It looks to me that it is not hidden as it is not called .Recycle.Bin. The $ in windows is to hide a share but it isnt a share.

Edited by showstopper
Link to post

Not sure if this is expected/known, but just wanted to say... I stopped my unRAID array and while I had it down I figured I'd poke through settings on everything in the web GUI to see if there was anything I wanted to change that I couldn't normally do while the array was up. I tried to open the settings for Recycle Bin and it completely hung up my browser (latest Chrome) tab. I tried reloading the browser just back to my main unRAID webpage, but did not work either. After 10-15 minutes I logged into my server via SSH and poked around the processes. I found the php process trying to open Recycle Bin settings and tried to kill <PID> it, but browser tab was still hung up. The proc stayed around as [defunct] so I found the parent process was the emhttp background process. Killed and and then restarted that with "&" cmd and was able to access the web GUI again. Restarted the whole server from there just to be safe.

 

So FYI, maybe you know this or maybe my system was just acting up, but might need to add check not to do something that causes that hang if the array is down when a user opens RB settings so it doesn't crap out.

Edited by deusxanime
Link to post
2 hours ago, deusxanime said:

Not sure if this is expected/known, but just wanted to say... I stopped my unRAID array and while I had it down I figured I'd poke through settings on everything in the web GUI to see if there was anything I wanted to change that I couldn't normally do while the array was up. I tried to open the settings for Recycle Bin and it completely hung up my browser (latest Chrome) tab. I tried reloading the browser just back to my main unRAID webpage, but did not work either. After 10-15 minutes I logged into my server via SSH and poked around the processes. I found the php process trying to open Recycle Bin settings and tried to kill <PID> it, but browser tab was still hung up. The proc stayed around as [defunct] so I found the parent process was the emhttp background process. Killed and and then restarted that with "&" cmd and was able to access the web GUI again. Restarted the whole server from there just to be safe.

 

So FYI, maybe you know this or maybe my system was just acting up, but might need to add check not to do something that causes that hang if the array is down when a user opens RB settings so it doesn't crap out.

This is what you get when the array is stopped:

59ccbbc9eb987_RecycleBinArrayStopped.png.d9188eb0bdd4aefe6b13671b986ca255.png

 

Looks like something in particular with your system.

Link to post
4 hours ago, dlandon said:

This is what you get when the array is stopped:

59ccbbc9eb987_RecycleBinArrayStopped.png.d9188eb0bdd4aefe6b13671b986ca255.png

 

Looks like something in particular with your system.

 

OK, good to know. It was probably something with my particular system then. I would have been surprised if something like that slipped through this long, but wanted to be put it out there just in case. Thanks!

Link to post
  • 2 weeks later...
16 minutes ago, joshuaavalon said:

How to make this work? I copy a PDF to a share and delete it on Win 10 but .Recycle.Bin does not show up.

I am on 6.3.5.

capture.thumb.PNG.98369a9ee1bfe9f48cc5d4b2f3917b89.PNG

Try to restart the recycle bin.  Turn on the "Log Deleted FIles?" and see if the file is logged.

 

What is the share?

Link to post
3 minutes ago, dlandon said:

Try to restart the recycle bin.  Turn on the "Log Deleted FIles?" and see if the file is logged.

 

What is the share?


It does not work. and it logged nothing.

I have a /temp share which is a network mount (V:) through smb on  win 10. I copy the file and delete it through win 10 file explorer.

Link to post
10 hours ago, joshuaavalon said:


It does not work. and it logged nothing.

I have a /temp share which is a network mount (V:) through smb on  win 10. I copy the file and delete it through win 10 file explorer.

Go to a command line and execute this:

/usr/local/sbin/samba restart

See if it works then.

Link to post
On 10/6/2017 at 8:47 PM, joshuaavalon said:


It does not work. and it logged nothing.

I have a /temp share which is a network mount (V:) through smb on  win 10. I copy the file and delete it through win 10 file explorer.

 

Same for me.

 

Ran the restart command bunch of times too.  Running 6.4.0-rc9f probably why?

/usr/local/sbin/samba restart
Link to post

I'd like to see the file /etc/samba/smb-shares.conf.  It contains the names of all your shares.  If you are comfortable with posting that in this thread, then please do.  If not then PM the file directly to me.

Link to post

Contains of /etc/samba/smb-shares.conf below.  The plugin has done something because there's a new folder in the /tmp called recycle.bin with a script in it called stop_recycle.bin.  Still no .Recycle.Bin folders, logs, etc.

 

cat /etc/samba/smb-shares.conf
[flash]
        path = /boot
        comment = unRAID Server OS boot device
        browseable = yes
        # Public
        public = yes
        writeable = yes
        vfs objects =
        map archive = no
        map system = no
        map hidden = no
        map readonly = yes
        create mask = 0777
        directory mask = 0777
[dockerappdata]
        path = /mnt/user/dockerappdata
        comment =
        browseable = yes
        # Secure
        public = yes
        writeable = no
        write list = XXXXXX
        vfs objects =
[kidshare]
        path = /mnt/user/kidshare
        comment =
        browseable = yes
        # Public
        public = yes
        writeable = yes
        vfs objects =
[networkdrive]
        path = /mnt/user/networkdrive
        comment =
        browseable = yes
        # Secure
        public = yes
        writeable = no
        write list = XXXXXX
        vfs objects =

Link to post

That file should contain entries like this:

	recycle:repository = %P/.Recycle.Bin/
	recycle:directory_mode = 0777
	recycle:keeptree = Yes
	recycle:touch = Yes
	recycle:touch_mtime = No
	recycle:minsize = 1
	recycle:versions = Yes
	recycle:exclude = *.tmp,*.ign,*.db-*
	recycle:exclude_dir = .Recycle.Bin

for all enabled shares.

 

At the command line execute this:

/usr/local/emhttp/plugins/recycle.bin/scripts/configure_recycle_bin

and let me know if there are any errors.

Link to post

Progress! No errors after running that command.  Now my /etc/samba/smb-shares.conf shows recycle bin info below.  The rest still didn't work until I ran "/usr/local/sbin/samba restart" twice. 

Thanks for the help.

 

[flash]
        path = /boot
        comment = unRAID Server OS boot device
        browseable = yes
        public = yes
        writeable = yes
        vfs objects = extd_audit recycle
        map archive = no
        map system = no
        map hidden = no
        map readonly = yes
        create mask = 0777
        directory mask = 0777
        recycle:repository = %P/.Recycle.Bin/
        recycle:directory_mode = 0777
        recycle:keeptree = Yes
        recycle:touch = Yes
        recycle:touch_mtime = No
        recycle:minsize = 1
        recycle:versions = Yes
        recycle:exclude = *.tmp
        recycle:exclude_dir = .Recycle.Bin
 

Link to post
43 minutes ago, dee31797 said:

Progress! No errors after running that command.  Now my /etc/samba/smb-shares.conf shows recycle bin info below.  The rest still didn't work until I ran "/usr/local/sbin/samba restart" twice. 

Thanks for the help.

 

[flash]
        path = /boot
        comment = unRAID Server OS boot device
        browseable = yes
        public = yes
        writeable = yes
        vfs objects = extd_audit recycle
        map archive = no
        map system = no
        map hidden = no
        map readonly = yes
        create mask = 0777
        directory mask = 0777
        recycle:repository = %P/.Recycle.Bin/
        recycle:directory_mode = 0777
        recycle:keeptree = Yes
        recycle:touch = Yes
        recycle:touch_mtime = No
        recycle:minsize = 1
        recycle:versions = Yes
        recycle:exclude = *.tmp
        recycle:exclude_dir = .Recycle.Bin
 

I appreciate that you are excited to have it solved for you, but that is not a good solution having to do things manually.  You should not have to initiate the recycle bin script to get the recycle bin to work.  You also shouldn't need to run the samba restart.

 

The script you ran is a recycle bin plugin event script that is run at about a 1 minute interval by unRAID.  The purpose of the script is to add the recycle bin configuration to the shares based on the settings in the recycle bin configuration.  The good news is that the script did not error out.  The bad news is why it is not running as it should.

 

Which version of unRAID are you running?

Link to post
  • dlandon changed the title to Recycle Bin (vfs recycle) for SMB Shares

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.