Recycle Bin (vfs recycle) for SMB Shares


dlandon

Recommended Posts

I love this plug in dlandon!  When I delete items from my Linux machine it puts them in  . Trash-1000 in the root of the active share.    Would it be possible to have this plug-in also monitor  .Trash-1000 when it comes to Empty &  purge functions?  Thanks :)

 

The Recycle Bin plugin manages samba deleted files and the trash you are talking about is created with NFS mounted shares.  I don't think it's a good idea to try to manage NFS trash with this plugin.

Perhaps a simple user script run by cron that periodically moves the folders into the Recycle Bin folders?

 

This would accomplish what you want.  Once a day?

Link to comment

I love this plug in dlandon!  When I delete items from my Linux machine it puts them in  . Trash-1000 in the root of the active share.    Would it be possible to have this plug-in also monitor  .Trash-1000 when it comes to Empty &  purge functions?  Thanks :)

 

The Recycle Bin plugin manages samba deleted files and the trash you are talking about is created with NFS mounted shares.  I don't think it's a good idea to try to manage NFS trash with this plugin.

Perhaps a simple user script run by cron that periodically moves the folders into the Recycle Bin folders?

 

This would accomplish what you want.  Once a day?

 

Good idea guys.  Yup,  this would be perfect :)

Link to comment

I love this plug in dlandon!  When I delete items from my Linux machine it puts them in  . Trash-1000 in the root of the active share.    Would it be possible to have this plug-in also monitor  .Trash-1000 when it comes to Empty &  purge functions?  Thanks :)

 

The Recycle Bin plugin manages samba deleted files and the trash you are talking about is created with NFS mounted shares.  I don't think it's a good idea to try to manage NFS trash with this plugin.

Perhaps a simple user script run by cron that periodically moves the folders into the Recycle Bin folders?

 

This would accomplish what you want.  Once a day?

 

Good idea guys.  Yup,  this would be perfect :)

 

You would have to create a script to do this.  I would suggest using User Scripts and set it up to run once a day.

Link to comment

Why is there now a RecycleBin directory in /mnt?  I woke up this morning to Fix Common Problems complaining that there is now "Invalid folder RecycleBin contained within /mnt".  It has a modified date/time that keeps updating and I assume that it was created by this plugin although its user/group is root/root.

Link to comment
2 hours ago, Ryland said:

Why is there now a RecycleBin directory in /mnt?  I woke up this morning to Fix Common Problems complaining that there is now "Invalid folder RecycleBin contained within /mnt".  It has a modified date/time that keeps updating and I assume that it was created by this plugin although its user/group is root/root.

 

The RecycleBin at /mnt/ is a directory of symlinks to the .Recycle.Bin shares so it can be browsed by the built in file browser at /mnt/.  It updates every second to keep current with the .Recycle.Bin share directories.  FCP should ignore this directory.

  • Upvote 1
Link to comment
1 hour ago, dlandon said:

 

The RecycleBin at /mnt/ is a directory of symlinks to the .Recycle.Bin shares so it can be browsed by the built in file browser at /mnt/.  It updates every second to keep current with the .Recycle.Bin share directories.  FCP should ignore this directory.

 

Great, thanks.  I will tell FCP to ignore the error.

Link to comment
33 minutes ago, Lacehim said:

Is there a reason why this isn't working on some shares?

 

I have nothing in excluded shares, but for some reason nothing is recycled in "Backups" but in "Documents" it is.  It's a bit strange.

 

Figured it out.  Permissions was set as root, so ran the permissions script and it's working like a charm now.  Phew.

Link to comment
  • 1 month later...

I just updated from 6.2.4 to 6.3.3. Uninstalled the plugin before upgrade and reinstalled afterwards. Current version is 2017.03.26

 

However none of my shares are listed in the Included Shares section and files I delete are not moved to the .Recycle.Bin folder but as you can see, the plugin is detecting the existing bin folders.

 

Ignore the size. It's about 30 old movies I didn't remove before taking the screenshot.

 

aEvHnDm.png

 

SMB Extras has this in it:

 

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

 

I ran the docker safe new permissions but it didn't help.

 

I've tried to restart the server and the plugin a few times too without any luck.

 

What would the next step be to try to get it to work again?

 

Logs are attached.

unraid-diagnostics-20170430-0529.zip

Link to comment

I just checked mine and it was stopped, which is strange because it was turned off before and working.  Started it again, and same issue as your getting.

 

It has picked up one share only which is empty.  I'm running 6.3.3 and

2017.03.26 plugin that was updated a few days ago.
  • Upvote 1
Link to comment
1 hour ago, Lacehim said:

I just turned on log deleted files and all the shares appeared listed. :)  Give that a try.

 

This worked! Thank you! :D

 

However deleted files are not logged. The files gets moved to the .Recycle.Bin folder but the logs stays empty.

 

Never mind. Deletions are logged now. Maybe it was just slow to start.

Edited by SelfSD
I was wrong.
Link to comment
2 hours ago, SelfSD said:

 

This worked! Thank you! :D

 

However deleted files are not logged. The files gets moved to the .Recycle.Bin folder but the logs stays empty.

 

Never mind. Deletions are logged now. Maybe it was just slow to start.

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

  • Upvote 2
Link to comment

I had to find a file to undelete. I notice that the dates (accessed/modified/created) are all for the date/time the file was deleted.

Is there an option to retain the original date modified or created?

 

 

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

Link to comment
42 minutes ago, graywolf said:

I had to find a file to undelete. I notice that the dates (accessed/modified/created) are all for the date/time the file was deleted.

Is there an option to retain the original date modified or created?

 

 

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

No.  That's how the samba vfs recycle works and I have no control over that.

  • Upvote 1
Link to comment

Not sure what the PlugIn does behind the scenes but is it possible to allow one or the other of these as options?

Depending upon which one you are not using for your Aging logic?

 

recycle:touch = BOOL
    Specifies whether a file's access date should be updated when the file is moved to the repository.
recycle:touch_mtime = BOOL
    Specifies whether a file's last modified date should be updated when the file is moved to the repository.

 

https://www.samba.org/samba/docs/man/manpages/vfs_recycle.8.html

 

 

 

 

Link to comment
52 minutes ago, graywolf said:

Not sure what the PlugIn does behind the scenes but is it possible to allow one or the other of these as options?

Depending upon which one you are not using for your Aging logic?

 

recycle:touch = BOOL
    Specifies whether a file's access date should be updated when the file is moved to the repository.
recycle:touch_mtime = BOOL
    Specifies whether a file's last modified date should be updated when the file is moved to the repository.

 

https://www.samba.org/samba/docs/man/manpages/vfs_recycle.8.html

 

 

 

 

The mtime date is used to age the files in the recycle bin using 'find -mtime...', so that date has to be modified when put in the recycle bin.

 

The access time is not updated on unRAID shares because of the way disks are mounted:

 

mount -t xfs -o noatime,nodiratime /dev/md1 /mnt/disk1

 

I'm not sure what value the access date would have if it is not changed going to the recycle bin because the access date is not kept current.

Edited by dlandon
  • Upvote 1
Link to comment

It looks like I could switch to not update the modify date (recycle:touch_mtime = 'No') , but update the access date (recycle:touch = 'Yes') and use that to purge the files.  I would then use 'find -atime' to purge files from the recycle bin.

Link to comment
56 minutes ago, dlandon said:

It looks like I could switch to not update the modify date (recycle:touch_mtime = 'No') , but update the access date (recycle:touch = 'Yes') and use that to purge the files.  I would then use 'find -atime' to purge files from the recycle bin.

Done.

 

The file directory in the recycle bin is created when the file is deleted so it will show the date/time when the file(s) were deleted, but the modify date/time on the files will remain unchanged.  Files will be purged from the recycle bin when the access date/time (which is the deletion date/time) ages the file.

Edited by dlandon
  • Upvote 2
Link to comment
On 2/7/2017 at 6:26 PM, dlandon said:

 

Ok.  One last thing.  Do this command:

 


/etc/rc.d/rc.samba restart
 

 

 

 

Just wanted to chime in that I had to do this step as well to get the recycle bin working.  Don't know if there's a way to do this automatically when the plugin is installed, or if that's just bad form to do automatically, but seems to be a required step.  Perhaps add the command to the plugin install info or something?

 

Thanks for this, very useful plugin.

Link to comment
  • 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.