Samba Recycle Bin with VFS_Recycle


Recommended Posts

You can change the path, make sure to do it in /boot/config/plugins/vfs_recycle/config/smb-extra.conf and then stop/start the plug-in for the change to take effect.

 

The plug-in won't work on 4.7 but the recycle MIGHT, depends on what version of samba is installed.

 

Ok, thanks for the quick reply, going to get me some 4TB disks and update to v5 in the next few weeks, will add this in then.

 

cheers

Link to comment
  • 7 months later...

Here's the initial release. I've been using it and have sent it to a few other users.

 

What the plugin does:

Once enabled the plug-in copies the config to your smb-extra.conf, if the file does not exist it is created.

 

Here is the config:

#vfs_recycle_start
#Recycle bin share
[bIN]
path = /mnt/user/BIN
read only = No

#vfs config
[global]
vfs objects = recycle 
        recycle:repository = /mnt/user/BIN/%m/%P
        recycle:keeptree = Yes
        recycle:touch = Yes
        recycle:versions = Yes
        recycle:exclude = *.tmp
        recycle:exclude_dir = /tmp
        recycle:noversions = *.doc
#vfs_recycle_end

 

Do NOT remove the comments from the config, they are used to add and remove the config if a user wishes to disable the recycle bin.

 

Options will be added in the near future to allow customization of the recycle bins path as well as repository options, as for now it will create a share named BIN, when a file is deleted it will be put in a directory named after the current user, and then in the full path to the file so you will know where the file came from if you were to wish to restore it.

 

Also included is the option to permanently delete the trash once a week. Enabling this feature creates a cronjob that runs every Sunday at 3:30 AM. Default the cron will be set to remove files that were deleted/trashed over 720 minutes (12 hours) ago. This option is user configurable and MUST be in minutes. I chose minutes as I believe this will allow the users the most flexibility on what files to delete. To delete everything simply set to 1 minute. 0 minutes should work fine too but I haven't tested that. If you want every file older than 7 days deleted, set it to 10080.

 

Also when on the plug-ins settings page you'll notice a trash bin on the left side of the screen. This bin will change from an empty bin to a full bin when you have trash, as well as reporting the current size of the bin. You may manually delete everything in the recycle bin by simply clicking the "empty trash" button. This will save less experienced users from possibly having a typo and removing a lot more than they intended.

 

Alright, so that should explain it all. Until options to modify the paths are added you may edit the smb-extra.conf located in /boot/config/plugins/vfs_recycle/config/. This is the base file used to add/remove the config from samba. If you wish to add anything to it just be sure to keep any additions/changes between the #vfs_recycle_start and #vfs_recycle_end comments.

 

Grab it HERE! (right click > save as)

 

Got the plugin working great, thanks Influencer. A couple of question though. I installed it in boot/config/plugins and on a reboot the plg file has gone, any ideas. Also this is just for looks really but is there anyway the icon in the settings page of the webGui could be called Recycle Bin or Trash Can as apposed to vfs_recycle_bin.

Many thanks for making this into a plugin.

Link to comment
  • 2 months later...

Looks a bit abandoned to me.  I PM'd him and got no reply.  :(

 

The .plg doesn't work for me, spits out an error on installation to do with downloading from his dropbox account.

 

Might have to try a manual install.  Seriously though I set up a Synology unit for a customer and it had toggles for enabling a recycle bin.  Why unraid doesn't have one I don't know.

Link to comment

I contacted Influencer by PM and he replied.  He hasn't disappeared and he noticed many of the plug-ins have been picked up by Phaze but he said to let everyone know he's still around.  He's said between work and other endeavors unraid has been placed on the back-burner for a while until he has more time.  3 kids, a wife and working 12 hours a day 6 days a week takes up all his time which I fully understand.  I'm in the same boat as a stay home dad, life is busy!

 

Anyway, he fixed up the issues with the recycle bin .plg so it's working now (I just installed it).  Woohoo no more accidental deletions of my data!!!!

 

Grab it Here!! (right click > save as) and reboot or install it from the console using

 

installplg /boot/config/plugins/vfs_recycle_unplugged.plg

 

The go to the settings page of unraid menu, and turn it on and enable. :)

Link to comment
  • 1 month later...

Alright, I removed the *.tmp and /tmp exclusions from the config until I can find what update stopped them from working correctly. In the meantime if you delete anything from the temp directory or a temp file you will need to remove them from the BIN manually. Not a huge deal as I suspect many people don't create/delete temp files often.

 

Just delete /boot/config/plugins/vfs_recycle/config/smb-extra.conf, redownload the plugin and install. Should be good to go.

 

Now the fact that the config pages no longer show up I'll still need to look at. I suspect the file path has changed.

Link to comment
  • 2 weeks later...

Downloaded and installplg. Initially had a SSL certificate area connecting to the https address to download images (device_status.png, new_config.png and information.png) so downloaded manually, and removed that code from the plg.

 

Re-installplg and running sweeeeeeet as.

 

Thank you :D

Link to comment
  • 1 month later...

Tried to get the plugin to work (5.06). It created the deleted directories but not any of the files. Any ideas?

my /boot/config/smb-extra.conf is:

 

#vfs_recycle_start

#Recycle bin share

[bIN]

        path = /mnt/user/BIN

        read only = No

 

#vfs config

[global]

vfs objects = recycle

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

#vfs_recycle_end

 

 

also, the update plg button is broken as it tries to download:

wget -q --no-check-certificate https://github.com/Influencer/UNplugged/raw/master/vfs_recycle_unplugged.plg

 

which does not exist...but it moves the existing plugin to old so it breaks it for re-install.

 

Link to comment

Okay, I figured out part of the problem is due to a bug:

http://askubuntu.com/questions/186057/samba-recycle-bin-in-ubuntu-12-04

 

Add the crossrename and do not forget the crossrename:sizelimit otherwise it won't recycle any files larger than 50Mb.

 

I still can't get the plug in to reload on start up. I'm not quite sure why, but on reboot, my /boot/config/smb-extra.conf just contains:

 

 

[global]

  security = USER

  guest account = nobody

  public = yes

  guest ok = yes

 

Lastly, is there a way to make sure recycled files stay on the same disk. I'd like to avoid spinning up other disks and moving files back and forth.

 

 

[global]

vfs objects = recycle crossrename

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

        crossrename:sizelimit = 5000

 

 

 

Tried to get the plugin to work (5.06). It created the deleted directories but not any of the files. Any ideas?

my /boot/config/smb-extra.conf is:

 

#vfs_recycle_start

#Recycle bin share

[bIN]

        path = /mnt/user/BIN

        read only = No

 

#vfs config

[global]

vfs objects = recycle

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

#vfs_recycle_end

 

 

also, the update plg button is broken as it tries to download:

wget -q --no-check-certificate https://github.com/Influencer/UNplugged/raw/master/vfs_recycle_unplugged.plg

 

which does not exist...but it moves the existing plugin to old so it breaks it for re-install.

Link to comment

Okay, I figured out part of the problem is due to a bug:

http://askubuntu.com/questions/186057/samba-recycle-bin-in-ubuntu-12-04

 

Add the crossrename and do not forget the crossrename:sizelimit otherwise it won't recycle any files larger than 50Mb.

 

I still can't get the plug in to reload on start up. I'm not quite sure why, but on reboot, my /boot/config/smb-extra.conf just contains:

 

 

[global]

  security = USER

  guest account = nobody

  public = yes

  guest ok = yes

 

Lastly, is there a way to make sure recycled files stay on the same disk. I'd like to avoid spinning up other disks and moving files back and forth.

 

 

[global]

vfs objects = recycle crossrename

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

        crossrename:sizelimit = 5000

 

 

 

Tried to get the plugin to work (5.06). It created the deleted directories but not any of the files. Any ideas?

my /boot/config/smb-extra.conf is:

 

#vfs_recycle_start

#Recycle bin share

[bIN]

        path = /mnt/user/BIN

        read only = No

 

#vfs config

[global]

vfs objects = recycle

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

#vfs_recycle_end

 

 

also, the update plg button is broken as it tries to download:

wget -q --no-check-certificate https://github.com/Influencer/UNplugged/raw/master/vfs_recycle_unplugged.plg

 

which does not exist...but it moves the existing plugin to old so it breaks it for re-install.

 

You don't need the plugin at all anymore once you have the [global] section with recycle and vs objects in your smb-extra.cfg. Just modify that file if you ever want to do changes.

 

 

Link to comment

For some reason it gets overwritten every time I reboot. I do not know why....nothing obvious the go script.

So, I had to add:

echo "Start recycle bin."

/etc/rc.d/rc.samba stop

cat /boot/config/plugins/vfs_recycle/config/smb-extra.conf >> /boot/config/smb-extra.conf

smbcontrol smbd reload-config

/etc/rc.d/rc.samba start

 

to the bottom of my go script.

The plugin also has an empty recycle bin feature and tells you the size.

 

Okay, I figured out part of the problem is due to a bug:

http://askubuntu.com/questions/186057/samba-recycle-bin-in-ubuntu-12-04

 

Add the crossrename and do not forget the crossrename:sizelimit otherwise it won't recycle any files larger than 50Mb.

 

I still can't get the plug in to reload on start up. I'm not quite sure why, but on reboot, my /boot/config/smb-extra.conf just contains:

 

 

[global]

  security = USER

  guest account = nobody

  public = yes

  guest ok = yes

 

Lastly, is there a way to make sure recycled files stay on the same disk. I'd like to avoid spinning up other disks and moving files back and forth.

 

 

[global]

vfs objects = recycle crossrename

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

        crossrename:sizelimit = 5000

 

 

 

Tried to get the plugin to work (5.06). It created the deleted directories but not any of the files. Any ideas?

my /boot/config/smb-extra.conf is:

 

#vfs_recycle_start

#Recycle bin share

[bIN]

        path = /mnt/user/BIN

        read only = No

 

#vfs config

[global]

vfs objects = recycle

        recycle:repository = /mnt/user/BIN/%m/%P

        recycle:keeptree = Yes

        recycle:touch = Yes

        recycle:versions = Yes

        recycle:noversions = *.doc

#vfs_recycle_end

 

 

also, the update plg button is broken as it tries to download:

wget -q --no-check-certificate https://github.com/Influencer/UNplugged/raw/master/vfs_recycle_unplugged.plg

 

which does not exist...but it moves the existing plugin to old so it breaks it for re-install.

 

You don't need the plugin at all anymore once you have the [global] section with recycle and vs objects in your smb-extra.cfg. Just modify that file if you ever want to do changes.

Link to comment
  • 2 weeks later...

You don't need the plugin at all anymore once you have the [global] section with recycle and vs objects in your smb-extra.cfg. Just modify that file if you ever want to do changes.

 

@Brit  Can you be a little more specific for us more challenged.  :)  I'd like to get a recycle bin set up, but, not having any luck.  Thanks.

Link to comment
  • 1 month later...

Is this dead?  Anything like this coming to/available for 6.0-beta12?  Thanks.

 

This is the first I've heard of it... If you want something to be added to unRAID however I suggest creating a new posting in the feature request form, becuase I think this slipped past everyones radar since it's hidden down here in User Customizations. 

Link to comment
  • 1 month later...

I wanted to try that feature out but since the original plugin wasn't working for

unRAID 6b14 (since they changed how ".page" and ".php" work together) I made the changes for me

exclusively. If this might interrest anyone, I mean I don't offer any support I just "patched" everything to make it work

So I forked the original work (https://github.com/Jencryzthers/UNplugged/blob/dev/vfs_recycle_unplugged.plg)

 

Open up your plugin page and copy this link: https://raw.githubusercontent.com/Jencryzthers/UNplugged/dev/vfs_recycle_unplugged.plg

to install it. I tested it and it seems to work pretty well so far.

 

*Use at your own risk*

Link to comment
  • 2 weeks later...

I wanted to try that feature out but since the original plugin wasn't working for

unRAID 6b14 (since they changed how ".page" and ".php" work together) I made the changes for me

exclusively. If this might interrest anyone, I mean I don't offer any support I just "patched" everything to make it work

So I forked the original work (https://github.com/Jencryzthers/UNplugged/blob/dev/vfs_recycle_unplugged.plg)

 

Open up your plugin page and copy this link: https://raw.githubusercontent.com/Jencryzthers/UNplugged/dev/vfs_recycle_unplugged.plg

to install it. I tested it and it seems to work pretty well so far.

 

*Use at your own risk*

 

Appreciate your time with this.  But, I am still unable to get this working.  I copied the link you posted and it shows the plug-in installed.  Is there any setting I need to change?  I thought it was supposed to show up in settings.  Doesn't for me. :(  Any help is appreciated.  Thanks.

Link to comment

What do you have in /usr/local/emhttp/plugins/ ?

 

Try to look for /usr/local/emhttp/plugins/&name;/  Where &name; is Recycle Bin or vfs_recycle and try to look if it's in the right category

It should be in "Utilities"

 

Or try removing using ssh/telnet  /usr/local/emhttp/plugins/Recycle Bin and /usr/local/emhttp/plugins/vfs_recycle manually and install it back

(I might have updated a few things since then)

 

Else report back

 

 

 

Link to comment

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.