Recycle Bin (vfs recycle) for SMB Shares


dlandon

Recommended Posts

One of the things I have seen is that the .Recycle.Bin folders on the cache drive shares get moved off the cache drive to the array.

What? I thought that was fixed when they changed the default mover implementation to only move cache "yes" shares instead of ignoring cache "only" shares.

 

Does the .Recycle.Bin share have a normal share property page in the gui?

 

It is changed now. There will be no .Recycle.Bin share.  There will be a .Recycle.Bin folder in each share.  Those folders will follow the rules for the share the folder is in. User permissions, cache only, etc because it is now a folder in the share and not a separate share.

Link to comment

I just uploaded a new release that implements the recycle bin at the share level.  Please follow the update procedure or you will leave behind files in the old recycle bin.

 

UPDATE PROCEDURE:

- Empty the recycle bin.

- Uninstall plugin.

- Re-install plugin.

 

https://github.com/dlandon/vfs_recycle/raw/master/vfs_recycle.plg

 

This is the operation I have wanted all along.  I apologize for the gyrations in getting this plugin to this point.  I don't anticipate any more major changes.

 

What this new release does is to create a .Recycle.Bin folder for every smb share on your server.  The flash drive and any drives mounted are included.  This includes unassigned devices and any other devices mounted and shared.  There is no longer a .Recycle.Bin share.  The advantages to this are:

- Each share has its own .Recycle.Bin folder.  To recover a file you browse to the share recycle bin using //Tower/share/.Recycle.Bin.

- If you turn off the hide dot files in the smb settings, you can browse to the share .Recycle.Bin.

- The mover moves the share .Recycle.Bin folder based on that share's settings dealing with the cache.

- Any User that has access to the share, also has access to the .Recycle.Bin.  If they have read/write access to the share, they also have read/write access to the .Recycle.Bin.

- User permissions are enforced when accessing the .Recycle.Bin.

 

The webgui browser is set up to only browse .Recycle.Bin folders in the /mnt/user directory.  The any device not mounted at /mnt/user will not show up in the gui browse.  You can browse the flash shares and devices through the webgui using the Main tabs.

 

With the recycle bin enabled for every share, you might have to manage the recycle bin for that share.  For example, the flash drive could begin to fill with deleted files.  Watch the shares that are cache only like docker and domains.  Deleted files in normal operation may begin to use a lot of cache space.

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.

 

The webgui browse, "Empty Trash" and "Removed Aged Files" only work at the /mnt/user level currently.  I am unsure how best to deal with the flash and other shares not mounted at the /mnt/user level.  I am going to work on this a bit to see if I can include all .Recycle.Bin folders.

 

I believe we will need more automated recycle bin management to keep it under control.  Daily task to manage?

Link to comment

 

The webgui browse, "Empty Trash" and "Removed Aged Files" only work at the /mnt/user level currently.  I am unsure how best to deal with the flash and other shares not mounted at the /mnt/user level.  I am going to work on this a bit to see if I can include all .Recycle.Bin folders.

Does this mean it will empty the .Recycle.Bin for all shares that are located at /mnt/user, such as /mnt/user/Movies, mnt/user/TV, mnt/user/Music?

 

How would one have a share mounted outside of /mnt/user? The Unassigned Devices plugin?

Link to comment
I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.
Haven't tried it, but in theory if the folder is created at the root of the drive, it will automatically become a user share.
Link to comment

 

The webgui browse, "Empty Trash" and "Removed Aged Files" only work at the /mnt/user level currently.  I am unsure how best to deal with the flash and other shares not mounted at the /mnt/user level.  I am going to work on this a bit to see if I can include all .Recycle.Bin folders.

Does this mean it will empty the .Recycle.Bin for all shares that are located at /mnt/user, such as /mnt/user/Movies, mnt/user/TV, mnt/user/Music?

 

Yes.

 

How would one have a share mounted outside of /mnt/user? The Unassigned Devices plugin?

 

Yes.  The flash is also not mounted at /mnt/user.

Link to comment

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.
Haven't tried it, but in theory if the folder is created at the root of the drive, it will automatically become a user share.

 

Probably a hidden share.  I'm not sure exactly how this would work.  I may fire up the test server and play with it.

Link to comment

I have a .Recycle.Bin folder on all my disks after installing the plugin. I have my disk shares set as public but hidden. Using telnet I can list all shares at mnt/user and it does show a hidden share called ".Recycle.Bin". The share is not listed in the webGUI. In the SMB settings I have hide dot files set to "no", but the .Recycle.Bin share does not show up in windows explorer when browsing the tower. It also is not accessible via "\\TOWER\RecycleBin" or "\\TOWER\.Recycle.Bin".

Link to comment

I have a .Recycle.Bin folder on all my disks after installing the plugin. I have my disk shares set as public but hidden. Using telnet I can list all shares at mnt/user and it does show a hidden share called ".Recycle.Bin". The share is not listed in the webGUI. In the SMB settings I have hide dot files set to "no", but the .Recycle.Bin share does not show up in windows explorer when browsing the tower.

 

Did you empty the trash bin and uninstall the previous version before you installed the new version?

Link to comment

Yes I did. I followed the instructions to the letter.

 

It doesn't bother me that the folders are on those disk shares, but I just wanted to report it as it appeared to be an item of question. I deleted all the folders by hand and the hidden share ".Recycle.Bin" went away.

 

Then I tested deleting a file from "disk1" and the .Recycle.Bin folder was created on disk1 as expected. This does cause a hidden share called ".Recycle.Bin" to be created. Honestly this does not bother me as it is hidden.

Link to comment

Yes I did. I followed the instructions to the letter.

 

It doesn't bother me that the folders are on those disk shares, but I just wanted to report it as it appeared to be an item of question. I deleted all the folders by hand and the hidden share ".Recycle.Bin" went away.

 

Then I tested deleting a file from "disk1" and the .Recycle.Bin folder was created on disk1 as expected. This does cause a hidden share called ".Recycle.Bin" to be created. Honestly this does not bother me as it is hidden.

 

It would probably be better to manage the recycle bin at the user shares and not the disk shares.  Why are you deleting files from a disk share?

Link to comment

When a file is deleted from the disk share, it creates the hidden folder .Recycle.Bin on the disk.  Because a disk folder is considered a share, you are creating a hidden share called .Recycled.Bin when you do that.  It will mount at /mnt/user/.Recycled.Bin.  I believe it can be browsed to and will contain all deleted files on the disks, and not the shares.

 

I would recommend managing your recycle bin from the user shares, and not the disk shares.  Files deleted on the disk directly will not show in the user share because it was not deleted from the user share.

 

EDIT: It goes like this: Delete file.txt from the disk.  It will be put in the /mnt/diskx/.Recycled.Bin/file.txt folder.  A user share is on the same level as the .Recycled.Bin folder and they are considered separate shares.  A user share cannot see the recycle bin folder on the disk.

Link to comment

When a file is deleted from the disk share, it creates the hidden folder .Recycle.Bin on the disk.  Because a disk folder is considered a share, you are creating a hidden share called .Recycled.Bin when you do that.  It will mount at /mnt/user/.Recycled.Bin.  I believe it can be browsed to and will contain all deleted files on the disks, and not the shares.

 

I would recommend managing your recycle bin from the user shares, and not the disk shares.

Right. I don't manage files usually from the disk share, but I was just testing it based on the text from your earlier post:

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.
Haven't tried it, but in theory if the folder is created at the root of the drive, it will automatically become a user share.

 

Probably a hidden share.  I'm not sure exactly how this would work.  I may fire up the test server and play with it.

 

I thought I'd test it and report back to save you from having to fire up a test system.

Link to comment

When a file is deleted from the disk share, it creates the hidden folder .Recycle.Bin on the disk.  Because a disk folder is considered a share, you are creating a hidden share called .Recycled.Bin when you do that.  It will mount at /mnt/user/.Recycled.Bin.  I believe it can be browsed to and will contain all deleted files on the disks, and not the shares.

 

I would recommend managing your recycle bin from the user shares, and not the disk shares.

Right. I don't manage files usually from the disk share, but I was just testing it based on the text from your earlier post:

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.
Haven't tried it, but in theory if the folder is created at the root of the drive, it will automatically become a user share.

 

Probably a hidden share.  I'm not sure exactly how this would work.  I may fire up the test server and play with it.

 

I thought I'd test it and report back to save you from having to fire up a test system.

 

I did take a minute to give it a go.

 

Yes a hidden share is created.  Any folder at the array disk level will end up being collected into a shared folder mounted at /mnt/user/.Recycled.Bin.  This is what unRAID does.  What everyone needs to keep in mind is that with the latest changes I've made, every share - user shares, disk shares, flash, and devices mounted with unassigned devices will all be smb shares and each will have its own .Recycled.Bin folder.  Those on the array disk devices will be collected into a hidden .Recycled.Bin share mounted at /mnt/user/.Recycled.Bin.  All share .Recycled.Bin folders will be browseable in their respective shares and not collected into a hidden share.  The .Recycled.Bin folders in the shares will be treated like any other folder on the share with respect to user access and cache operations (cache only, etc).

 

The webgui only browses the /mnt/user/*/.Recycled.Bins.  These are the files of most interest.

 

Link to comment

When a file is deleted from the disk share, it creates the hidden folder .Recycle.Bin on the disk.  Because a disk folder is considered a share, you are creating a hidden share called .Recycled.Bin when you do that.  It will mount at /mnt/user/.Recycled.Bin.  I believe it can be browsed to and will contain all deleted files on the disks, and not the shares.

 

I would recommend managing your recycle bin from the user shares, and not the disk shares.

Right. I don't manage files usually from the disk share, but I was just testing it based on the text from your earlier post:

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.
Haven't tried it, but in theory if the folder is created at the root of the drive, it will automatically become a user share.

 

Probably a hidden share.  I'm not sure exactly how this would work.  I may fire up the test server and play with it.

 

I thought I'd test it and report back to save you from having to fire up a test system.

 

I did take a minute to give it a go.

 

Yes a hidden share is created.  Any folder at the array disk level will end up being collected into a shared folder mounted at /mnt/user/.Recycled.Bin.  This is what unRAID does.  What everyone needs to keep in mind is that with the latest changes I've made, every share - user shares, disk shares, flash, and devices mounted with unassigned devices will all be smb shares and each will have its own .Recycled.Bin folder.  Those on the array disk devices will be collected into a hidden .Recycled.Bin share mounted at /mnt/user/.Recycled.Bin.  All share .Recycled.Bin folders will be browseable in their respective shares and not collected into a hidden share.  The .Recycled.Bin folders in the shares will be treated like any other folder on the share with respect to user access and cache operations (cache only, etc).

 

The webgui only browses the /mnt/user/*/.Recycled.Bins.  These are the files of most interest.

OK, I can't help myself drilling down on this some more.

 

What happens if a file is deleted from the .Recycled.Bin share? Does it get saved to a .Recycled.Bin folder within the .Recycled.Bin share? So, /mnt/user/.Recycled.Bin/.Recycled.Bin/ ?

Link to comment

Based on my quick test I believe the answer is no. When I deleted a file from within .Recycle.Bin it was permanently removed as one would expect.

 

But I have noticed that the .Recycle. Bin in each share actually puts the share units path after .Recycle.Bin. So for example I have a share called "Books". When I delete a file from the share I get the following path for the RecycleBin:

/mnt/user/Books/.Recycle.Bin/Books/filename

 

I assume this may be due to the settings in the plugin where the parameters is set to %S. Is that correct?

 

And thank you so much for all the work on this.

Link to comment

When a file is deleted from the disk share, it creates the hidden folder .Recycle.Bin on the disk.  Because a disk folder is considered a share, you are creating a hidden share called .Recycled.Bin when you do that.  It will mount at /mnt/user/.Recycled.Bin.  I believe it can be browsed to and will contain all deleted files on the disks, and not the shares.

 

I would recommend managing your recycle bin from the user shares, and not the disk shares.

Right. I don't manage files usually from the disk share, but I was just testing it based on the text from your earlier post:

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.

 

I do not share my disk drives and have not tired, but the same recycle bin operation should occur if you share the disk drives and delete files at the drive level.  The drive share will have a .Recycle.Bin for the drive.
Haven't tried it, but in theory if the folder is created at the root of the drive, it will automatically become a user share.

 

Probably a hidden share.  I'm not sure exactly how this would work.  I may fire up the test server and play with it.

 

I thought I'd test it and report back to save you from having to fire up a test system.

 

I did take a minute to give it a go.

 

Yes a hidden share is created.  Any folder at the array disk level will end up being collected into a shared folder mounted at /mnt/user/.Recycled.Bin.  This is what unRAID does.  What everyone needs to keep in mind is that with the latest changes I've made, every share - user shares, disk shares, flash, and devices mounted with unassigned devices will all be smb shares and each will have its own .Recycled.Bin folder.  Those on the array disk devices will be collected into a hidden .Recycled.Bin share mounted at /mnt/user/.Recycled.Bin.  All share .Recycled.Bin folders will be browseable in their respective shares and not collected into a hidden share.  The .Recycled.Bin folders in the shares will be treated like any other folder on the share with respect to user access and cache operations (cache only, etc).

 

The webgui only browses the /mnt/user/*/.Recycled.Bins.  These are the files of most interest.

OK, I can't help myself drilling down on this some more.

 

What happens if a file is deleted from the .Recycled.Bin share? Does it get saved to a .Recycled.Bin folder within the .Recycled.Bin share? So, /mnt/user/.Recycled.Bin/.Recycled.Bin/ ?

 

Wow, you are really digging into this.  Over the last week I have done a lot of research and experimentation.  There really isn't much documentation I could find on samba that was helpful.  So what I learned was mostly from trial and error.

 

No the .Recycled.Bin folder is excluded from being put in the recycled bin folder.  According to what I know, any file deleted from the .Recycled.Bin folder will be deleted in the normal fashion.  Otherwise you'd end up with a circular delete - anything deleted from the .Recycled.Bin folder would be put right back.

 

#vfs_recycle_start

#Recycle bin share

[global]

vfs objects = recycle

  recycle:repository = %P/.Recycle.Bin/%S

  recycle:directory_mode = 0777

  recycle:keeptree = Yes

  recycle:touch = Yes

  recycle:touch_mtime = Yes

  recycle:versions = Yes

  recycle:exclude = *.tmp,*.ign

  recycle:exclude_dir = .Recycle.Bin

#vfs_recycle_end

 

This is what I ended up getting to work exactly as I wanted.  The %P is the magic here.  That is the full share path so the .Recycle.Bin is in the direct share path, rather than being hard coded to /mnt/user...

Link to comment

Based on my quick test I believe the answer is no. When I deleted a file from within .Recycle.Bin it was permanently removed as one would expect.

 

But I have noticed that the .Recycle. Bin in each share actually puts the share units path after .Recycle.Bin. So for example I have a share called "Books". When I delete a file from the share I get the following path for the RecycleBin:

/mnt/user/Books/.Recycle.Bin/Books/filename

 

I assume this may be due to the settings in the plugin where the parameters is set to %S. Is that correct?

 

Yes.  You can take it off using the webgui and the files will go into the .Recycled.Bin without the share name.  I only did that so you could use the webgui browse and tell which share the files were on.  Otherwise the webgui will just list all the files from all shares.

 

#vfs_recycle_start

#Recycle bin share

[global]

vfs objects = recycle

  recycle:repository = %P/.Recycle.Bin/%S

  recycle:directory_mode = 0777

  recycle:keeptree = Yes

  recycle:touch = Yes

  recycle:touch_mtime = Yes

  recycle:versions = Yes

  recycle:exclude = *.tmp,*.ign

  recycle:exclude_dir = .Recycle.Bin

#vfs_recycle_end

 

I can't say that I am totally happy with the webgui browse.  I want all .Recycle.Bin folders collected and shown by share and browseable from there.  I am going to put a little time into this.

Link to comment

If one wants to prevent recycle bin on disk shares 1 and 2 you might be able to do this by adding the following to the setting of exclude_dir: /mnt/disk1 /mnt/disk2

 

I dont know if you could use wildcards such as

/mnt/disk*

 

I'm not sure that works because those are share mounts and not directories.

 

If I can find a way to exclude shares, I will implement something at the webgui.  Similar to what cache_dirs does when you select shares to exclude.

 

I've read somewhere that you can set the .Recycle.Bin folder to read only to exclude the deleted files.  I don't know if this will annoy vfs recycle or I suspect it will just move on and delete the file.

 

Do you feel the need to be able to exclude shares from the recycle bin?

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.