Recycle Bin (vfs recycle) for SMB Shares


dlandon

794 posts in this topic Last Reply

Recommended Posts

9 hours ago, MyKroFt said:

trying this again as you requested.

 

There is nothing in the deleted log section, no errors listed in syslog when I deleted a folder with aprox 20 files via a samba share, diags attached again

vlog.zip

Please post the following files.  You may want to PM these to me because they will have share information in them.

  • /boot/config/plugins/recycle.bin/recycle.bin.cfg
  • /boot/config/smb-extra.conf
  • /etc/samba/smb-shares.conf
Link to post
  • 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

7 hours ago, Mopar_Mudder said:

I just installed this for the first time as I just lost a bunch of files from an accidental delete, figure this would solve that in the future. I am on 6.3.5 and I can't get it to work. It is enabled and show . files is on. After deleting test files the recycle bin says empty still.

 

Not sure what logs need posting to help.

 

Well it just kinda worked, deleted 5 files and only 2 showed up in the recycle folder.

Some files will not be added to the recycle bin with certain file extensions or zero length files.  Give me some examples of files/file extensions that don't show up in the deleted files.

 

Please realize that when the recycle bin is started, it is up to Unraid to restart the samba service to enable the recycle bin.  It can take several minutes for that to happen.  Until samba is restarted to enable the recycle bins on the shares, deleting files will not show up in the recycle bin.

Link to post
1 hour ago, perfessor101 said:

 

I mentioned something a few months back about certain file extensions just disappearing on deletion and not being recycled. 

 

I was considering writing a script to generate all three letter file extensions and see how many got recycled ... but then I realized unRaid isn’t running on dos 3.0. 

Give me some examples of the file extensions that are not showing up in the recycle bin when deleted.

Link to post
3 hours ago, dlandon said:

Some files will not be added to the recycle bin with certain file extensions or zero length files.  Give me some examples of files/file extensions that don't show up in the deleted files.

 

Please realize that when the recycle bin is started, it is up to Unraid to restart the samba service to enable the recycle bin.  It can take several minutes for that to happen.  Until samba is restarted to enable the recycle bins on the shares, deleting files will not show up in the recycle bin.

All the files were JPG but I think a couple might have had a "0" files size because they were corrupt and I got rid of them, maybe that caused the problem. I tried again this morning on another bunch of JPG files that have been on the server for along time and all 5 showed up in the bin after deleting. So I will do some more testing on it and see what happens.

Link to post

Currently I can't get a recycle.bin working on either of my UnRaid arrays ... 6.6.0-rc3

 

wrote a script that generates a bunch of files with  single, double and triple character extensions (upper and lower case letters with numbers)  ... it generates about 242,234 files

four characters is over a million files ... that might take an hour or two to delete from Windows 7

 

Here's the script for the brave ... it's pretty bad ... took me 45 minutes of googling

 

When my arrays start co-operating again I'll give it another try

 

I put it on disk5 in my case under a directory called recycle.test and with a sub directory called test.directory

and hopefully makes a file named listing.before.delete.txt

 

After which one would then delete the generated files and do a new directory listing with ls -1a to a file called listing.after.delete.txt and then do a diff between them

 

Hopefully my variable names aren't too mangled


 

#!/bin/bash


dirroot=/mnt/disk5/recycle.test
dirtest=$dirroot/test.directory

for c1 in {A..Z} {a..z} {0..9}
do
     filename=1one
     extention=$c1
     printf "%s\n" "$dirtest/$filename.$extention"
     touch $dirtest/$filename.$extention
done

read -rsp $'1 - Press enter to continue...\n'

for c1 in {A..Z} {a..z} {0..9}
do
     for c2 in {A..Z} {a..z} {0..9}
     do
            filename=2two
            extention=$c1$c2
            printf "%s\n" "$dirtest/$filename.$extention"
            touch $dirtest/$filename.$extention
     done
done

read -rsp $'2 - Press enter to continue...\n'

for c1 in {A..Z} {a..z} {0..9}
do
     for c2 in {A..Z} {a..z} {0..9}
     do
         for c3 in {A..Z} {a..z} {0..9}
         do
            filename=3three
            extention=$c1$c2$c3
            printf "%s\n" "$dirtest/$filename.$extention"
            touch $dirtest/$filename.$extention
         done
     done
done

read -rsp $'3 - Press enter to continue...\n'

ls -1a $dirtest >$dirroot\listing.before.delete.txt

read -rsp $'Press enter to continue...\n'
read -rsp $'Press enter to continue...\n'
read -rsp $'Press enter to continue...\n'

 

Thanks for your time,

Bobby

Link to post
21 minutes ago, perfessor101 said:

Currently I can't get a recycle.bin working on either of my UnRaid arrays ... 6.6.0-rc3

 

wrote a script that generates a bunch of files with  single, double and triple character extensions (upper and lower case letters with numbers)  ... it generates about 242,234 files

four characters is over a million files ... that might take an hour or two to delete from Windows 7

 

Here's the script for the brave ... it's pretty bad ... took me 45 minutes of googling

 

When my arrays start co-operating again I'll give it another try

 

I put it on disk5 in my case under a directory called recycle.test and with a sub directory called test.directory

and hopefully makes a file named listing.before.delete.txt

 

After which one would then delete the generated files and do a new directory listing with ls -1a to a file called listing.after.delete.txt and then do a diff between them

 

Hopefully my variable names aren't too mangled


 


#!/bin/bash


dirroot=/mnt/disk5/recycle.test
dirtest=$dirroot/test.directory

for c1 in {A..Z} {a..z} {0..9}
do
     filename=1one
     extention=$c1
     printf "%s\n" "$dirtest/$filename.$extention"
     touch $dirtest/$filename.$extention
done

read -rsp $'1 - Press enter to continue...\n'

for c1 in {A..Z} {a..z} {0..9}
do
     for c2 in {A..Z} {a..z} {0..9}
     do
            filename=2two
            extention=$c1$c2
            printf "%s\n" "$dirtest/$filename.$extention"
            touch $dirtest/$filename.$extention
     done
done

read -rsp $'2 - Press enter to continue...\n'

for c1 in {A..Z} {a..z} {0..9}
do
     for c2 in {A..Z} {a..z} {0..9}
     do
         for c3 in {A..Z} {a..z} {0..9}
         do
            filename=3three
            extention=$c1$c2$c3
            printf "%s\n" "$dirtest/$filename.$extention"
            touch $dirtest/$filename.$extention
         done
     done
done

read -rsp $'3 - Press enter to continue...\n'

ls -1a $dirtest >$dirroot\listing.before.delete.txt

read -rsp $'Press enter to continue...\n'
read -rsp $'Press enter to continue...\n'
read -rsp $'Press enter to continue...\n'

 

Thanks for your time,

Bobby

I'm not sure I follow what you are up to, but I don't intend to waste my time with this script.  What does this prove or disprove?

 

When you say the recycle bin is not working, what is not working?  If you are not getting any files to show up in the recycle bin, then there is a more basic issue.

 

Please post the following files.  You may want to PM these to me because they will have share information in them.

  • /boot/config/plugins/recycle.bin/recycle.bin.cfg
  • /boot/config/smb-extra.conf
  • /etc/samba/smb-shares.conf
Link to post
13 hours ago, dlandon said:

Please post the following files.  You may want to PM these to me because they will have share information in them.

  • /boot/config/plugins/recycle.bin/recycle.bin.cfg
  • /boot/config/smb-extra.conf
  • /etc/samba/smb-shares.conf

 

PM sent

Thanks

Myk

 

Link to post
19 minutes ago, MyKroFt said:

 

PM sent

Thanks

Myk

 

You have the recycle bin enabled on appdata, system, nextcloud, and temp shares.  You should exclude those.  Especially appdata and system.  I suspect there is so much samba activity on those shares the recycle bin can't keep up.  Try to limit the recycle bin to shares where you really need its capabilities.

Link to post
26 minutes ago, dlandon said:

You have the recycle bin enabled on appdata, system, nextcloud, and temp shares.  You should exclude those.  Especially appdata and system.  I suspect there is so much samba activity on those shares the recycle bin can't keep up.  Try to limit the recycle bin to shares where you really need its capabilities.

ok, will do

 

Thanks for the direction

Link to post

For those of you that cannot get the recycle bin to work, there is an issue right now that I see in 6.5 and 6.6 that keep the recycle bin from working properly.  It may be that this issue applies to 6.4 also.

 

It seems that some changes were made in Unraid along the line that prevent the recycle bin parameters from getting applied when changes are made in the plugin parameters.  The recycle bin will be applied when the array is started, but changes in the plugin parameters will not get applied from the plugin webpage.  For the moment, you will have to stop and restart the server to get the recycle bin parameter changes applied.  This also applies to starting and stopping the recycle bin from the webpage.  I will be working with LT on solving this issue.

Link to post

I had a look for you...

 

Your plugin is using the event "svcs_restarting", but the event to be used is "svcs_restarted",

# svcs_restarted
#   Occurs during cmdStart execution.
#   Occurs as a result of changing/adding/deleting a share.
#   The network services are started and may be exporting different share(s).

I don't know (and didn't check) if the name has changed with 6.6

Link to post

I've updated the plugin to deal with a long standing issue related to the recycle bin configuring samba correctly.  Once you update to the latest plugin version, you should restart the recycle bin and it should work properly from then on.

 

For those of you that have had trouble getting the recycle bin to work at all, try the latest version and let me know if it works for you.

Link to post
  • 1 month later...
  • 2 weeks later...

Great plugin, handy to save from fat fingers when deleting files and such.

 

One request (may be a longshot, but you never know) - rather than adding a list of shares that you don't want enabled, would it be possible to flip it so there's a list of only shares you want active?  Or maybe both?  Just throwing it out there, I can deal either way.


Cheers!

Link to post

Virgin install on 6.6.5, recycle bin functionality works perfect as far as I can tell after running a few delete + empty tests, but the deleted file logging isn't coming up (yes it's enabled).

 

Screenshot of settings below, let me know if it's anything I've missed?

Thanks

 

image.thumb.png.8b4396d1a0ec7e4dfb90b83ce828646b.png

Edited by tjb_altf4
Link to post
4 hours ago, tjb_altf4 said:

Virgin install on 6.6.5, recycle bin functionality works perfect as far as I can tell after running a few delete + empty tests, but the deleted file logging isn't coming up (yes it's enabled).

 

Screenshot of settings below, let me know if it's anything I've missed?

Thanks

 

image.thumb.png.8b4396d1a0ec7e4dfb90b83ce828646b.png

Check the Settings->SMB->SMB Extras.  You should see this:

#vfs_recycle_start
#Recycle bin configuration
[global]
   syslog only = No
   log level = 0 vfs:0
#vfs_recycle_end

This sets the logging of the recycle bin.  See if there are any other global entries dealing with logging.

Link to post
20 minutes ago, tjb_altf4 said:

Thanks for the help, only other entries are unassigned devices.

So do you mean that those quoted lines are in your SMB extras? Might be useful if you just posted what you have for comparison,

Link to post
59 minutes ago, tjb_altf4 said:

include = /etc/samba/unassigned-shares/downloads.conf
include = /etc/samba/unassigned-shares/storage.conf
#vfs_recycle_start
#Recycle bin configuration
[global]
   syslog only = No
   log level = 0 vfs:0
#vfs_recycle_end

In it's entirety

I don't see anything wrong with that.

 

Run this command and see if the log has any entries:

cat /var/log/samba/log.smbd

 

Link to post

OK looking at the log (below)  I found entries related to folders (of deleted files) are visible (Kodi, IrfanView) but files themselves are not.

In between now and then some other recycle bin activities have occurred and some files went to recycle bin, other temp type files were deleted outright and these did show up in GUI log.

 

It seems the samba log is including records we're less interested in logging, and excluding what we are interested in?

 

image.png.833aa8fe1fac19e7676ec3824124d414.png

 

cat /var/log/samba/log.smbd output:

[2018/11/16 16:10:26.798241,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/software/.Recycle.Bin
[2018/11/16 16:10:26.798478,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/software/.Recycle.Bin/Kodi
[2018/11/16 16:10:30.227792,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Kodi/_db backups/.tmp
[2018/11/16 16:10:30.230186,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Kodi/_db backups/.tmp
[2018/11/16 16:15:22.667634,  0] ../lib/util/become_daemon.c:138(daemon_ready)
  daemon_ready: STATUS=daemon 'smbd' finished starting up and ready to serve connections
[2018/11/16 16:15:52.150000,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/software/.Recycle.Bin/IrfanView
[2018/11/16 16:20:38.684070,  0] ../lib/util/become_daemon.c:138(daemon_ready)
  daemon_ready: STATUS=daemon 'smbd' finished starting up and ready to serve connections
[2018/11/17 00:44:27.116724,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/tjb/.Recycle.Bin
[2018/11/17 00:44:27.116957,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/tjb/.Recycle.Bin/documents
[2018/11/17 00:44:27.117170,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/tjb/.Recycle.Bin/documents/home
[2018/11/17 00:44:27.117358,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/tjb/.Recycle.Bin/documents/home/iTunes
[2018/11/17 00:44:36.969299,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/downloading/233450
[2018/11/17 00:44:36.988766,  0] ../source3/modules/vfs_extd_audit.c:268(audit_unlink)
  vfs_extd_audit: unlink Steam/steamapps/downloading/233450/.temp_write_647cc4a7
[2018/11/17 00:44:37.543853,  0] ../source3/modules/vfs_extd_audit.c:268(audit_unlink)
  vfs_extd_audit: unlink Steam/steamapps/common/Prison Architect/.temp_write_c9c5f72d
[2018/11/17 00:44:37.549194,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/temp/233450
[2018/11/17 00:44:37.566873,  0] ../source3/modules/vfs_extd_audit.c:268(audit_unlink)
  vfs_extd_audit: unlink Steam/steamapps/temp/233450/.temp_write_7aefaecf
[2018/11/17 00:44:39.626607,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/downloading/233450/steam_shader_cache
[2018/11/17 00:44:39.755794,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/temp/233450/steam_shader_cache
[2018/11/17 00:44:39.821349,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin
[2018/11/17 00:44:39.821560,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam
[2018/11/17 00:44:39.821740,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps
[2018/11/17 00:44:39.821929,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps/temp
[2018/11/17 00:44:39.822136,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps/temp/233450
[2018/11/17 00:44:39.822328,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps/temp/233450/steam_shader_cache
[2018/11/17 00:44:39.825014,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/temp/233450/steam_shader_cache
[2018/11/17 00:44:39.827131,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/temp/233450
[2018/11/17 00:44:39.833493,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/downloading/233450/steam_shader_cache
[2018/11/17 00:44:39.839589,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/downloading/233450
[2018/11/17 00:44:39.848790,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps/downloading
[2018/11/17 00:44:39.914053,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/downloading/250900
[2018/11/17 00:44:39.925227,  0] ../source3/modules/vfs_extd_audit.c:268(audit_unlink)
  vfs_extd_audit: unlink Steam/steamapps/downloading/250900/.temp_write_32288f9
[2018/11/17 00:44:39.938174,  0] ../source3/modules/vfs_extd_audit.c:268(audit_unlink)
  vfs_extd_audit: unlink Steam/steamapps/common/The Binding of Isaac Rebirth/.temp_write_f7b8848c
[2018/11/17 00:44:39.940705,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/temp/250900
[2018/11/17 00:44:39.954151,  0] ../source3/modules/vfs_extd_audit.c:268(audit_unlink)
  vfs_extd_audit: unlink Steam/steamapps/temp/250900/.temp_write_bf2cdcd4
[2018/11/17 00:44:41.248923,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/downloading/250900/steam_shader_cache
[2018/11/17 00:44:41.375309,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir Steam/steamapps/temp/250900/steam_shader_cache
[2018/11/17 00:44:41.433327,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps/temp/250900
[2018/11/17 00:44:41.433567,  0] ../source3/modules/vfs_extd_audit.c:159(audit_mkdir)
  vfs_extd_audit: mkdir /mnt/user/games/.Recycle.Bin/Steam/steamapps/temp/250900/steam_shader_cache
[2018/11/17 00:44:41.436687,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/temp/250900/steam_shader_cache
[2018/11/17 00:44:41.439915,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/temp/250900
[2018/11/17 00:44:41.445601,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/downloading/250900/steam_shader_cache
[2018/11/17 00:44:41.448777,  0] ../source3/modules/vfs_extd_audit.c:180(audit_rmdir)
  vfs_extd_audit: rmdir Steam/steamapps/downloading/250900

 

Edited by tjb_altf4
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.