Recycle Bin (vfs recycle) for SMB Shares


dlandon

Recommended Posts

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?

 

I don't see the need, it was just one possible way to explore if someone didn't want or like how it operates on disk shares creating a new share.

Link to comment

I've changed the plugin name from "vfs_recycle" to "recycle.bin" and moved the repository to "recycle.bin" to be more compatible with plugin convention.  I also made some changes for plugin convention.

 

You will need to remove the current version of recycle bin and then re-install from this link:

https://github.com/dlandon/recycle.bin/raw/master/recycle.bin.plg

 

None of your deleted files will be affected and nothing about the operation of the recycle bin changes.

Link to comment

Was any conclusion reached about whether an individual share can be excluded from using the Recycle bin?  I have one share that is very active and for which I do not really need or want Recycle Bin support, so it would be nice to exclude it.

 

No one has really requested that.  I'll see what it would take to do that.

Link to comment

Was any conclusion reached about whether an individual share can be excluded from using the Recycle bin?  I have one share that is very active and for which I do not really need or want Recycle Bin support, so it would be nice to exclude it.

 

Because I am doing the recycle bin globally on all shares, I can't control a single share.  I was hoping I could block a share from putting deleted files in its .Recycle.Bin but I haven't found a way.  Probably the cleanest way to handle this is with a periodic cron to delete the //Share/.Recycle.Bin files.

 

For the moment you can set up a cron script to delete the recycle bin on the share.  Name it 'empty_share_recycle_bin

#!/bin/sh
rm -rf /mnt/user/Share/.Recycle.Bin/*

 

And copy it to /etc/cron.hourly/ and the script will run every hour, or /etc/cron.daily/ and the script will run daily.

Link to comment

Was any conclusion reached about whether an individual share can be excluded from using the Recycle bin?  I have one share that is very active and for which I do not really need or want Recycle Bin support, so it would be nice to exclude it.

 

Because I am doing the recycle bin globally on all shares, I can't control a single share.  I was hoping I could block a share from putting deleted files in its .Recycle.Bin but I haven't found a way.  Probably the cleanest way to handle this is with a periodic cron to delete the //Share/.Recycle.Bin files.

 

For the moment you can set up a cron script to delete the recycle bin on the share.  Name it 'empty_share_recycle_bin

#!/bin/sh
rm -rf /mnt/user/Share/.Recycle.Bin/*

 

And copy it to /etc/cron.hourly/ and the script will run every hour, or /etc/cron.daily/ and the script will run daily.

 

This is the best I can come up with to handle a share where the recycle bin is not wanted.  I'm thinking once a day is sufficient.  This would keep the disk operations to a minimum and would be handled when other daily jobs are run.  Each hour would probably be overkill and potentially spin up disks every hour to delete the recycle bin on a share.

 

If anyone has any feedback let me know.  I can add this functionality, but I want to make sure it makes sense before I do.

Link to comment

I have set up a job of the sort you mention to run hourly.  I will let you know how it goes.   

 

The share I want to use this for is confined to a single disk, and so keeping it spun up is not a big issue as it is typically spun up anyway.  I might also change it to daily later to see how that goes.

Link to comment

I have set up a job of the sort you mention to run hourly.  I will let you know how it goes.   

 

The share I want to use this for is confined to a single disk, and so keeping it spun up is not a big issue as it is typically spun up anyway.  I might also change it to daily later to see how that goes.

 

Let me know how it goes.  I am tending to favor a daily empty trash for selected shares.

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

 

It's not an anomaly.  The only shares managed at the Settings->RecycleBin are the user shares at /mnt/user/.  Any shares not mounted at /mnt/user have to be managed manually.  Click the 'Help' button for more information on the Settings->RecycleBin.  I would like to include the disk shares, but I'm having a few issues with that.

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

 

It's not an anomaly.  The only shares managed at the Settings->RecycleBin are the user shares at /mnt/user/.  Any shares not mounted at /mnt/user have to be managed manually.  Click the 'Help' button for more information on the Settings->RecycleBin.  I would like to include the disk shares, but I'm having a few issues with that.

OK.  :(

 

Since Samba put them into the .RecyledBin folder I thought the hard work had been done and it would probably just be a case of the plugin cycling through the disks as well looking for .RecycledBin folders when working out what to trash.  Obviously it is not as easy as it first appears  :)

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

 

It's not an anomaly.  The only shares managed at the Settings->RecycleBin are the user shares at /mnt/user/.  Any shares not mounted at /mnt/user have to be managed manually.  Click the 'Help' button for more information on the Settings->RecycleBin.  I would like to include the disk shares, but I'm having a few issues with that.

OK.  :(

 

Since Samba put them into the .RecyledBin folder I thought the hard work had been done and it would probably just be a case of the plugin cycling through the disks as well looking for .RecycledBin folders when working out what to trash.  Obviously it is not as easy as it first appears  :)

 

Why do you delete files from a disk share instead of a user share?

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

 

It's not an anomaly.  The only shares managed at the Settings->RecycleBin are the user shares at /mnt/user/.  Any shares not mounted at /mnt/user have to be managed manually.  Click the 'Help' button for more information on the Settings->RecycleBin.  I would like to include the disk shares, but I'm having a few issues with that.

OK.  :(

 

Since Samba put them into the .RecyledBin folder I thought the hard work had been done and it would probably just be a case of the plugin cycling through the disks as well looking for .RecycledBin folders when working out what to trash.  Obviously it is not as easy as it first appears  :)

 

It's not as much a technical issue as making sense for the user.  I didn't think that deleting files at the disk share was something that people did.  I guess I don't understand why one would do that.

 

I want to get the webgui to browse all the recycle bins.  I can't get the built in browser to browse /mnt/user/*/.Recycle.Bin and /mnt/disk*/.Recycle.Bin at the same time.  I don't think it's meant to handle that.  So I will have to set up a way to browse each one separately.

 

I am working on what might be a good solution to include disk shares, the flash share, and unassigned devices shares.

 

Link to comment

Speaking of anomalies, I suppose I'm one.  I still don't use User Shares, so would appreciate support for disk shares.

 

I have been wanting to try this as a plugin, once development settled down and there was sufficient testing.  I would also like to add it to the upgrade guide, as a recommended plugin.  I'll wait a little longer though for that.

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

 

It's not an anomaly.  The only shares managed at the Settings->RecycleBin are the user shares at /mnt/user/.  Any shares not mounted at /mnt/user have to be managed manually.  Click the 'Help' button for more information on the Settings->RecycleBin.  I would like to include the disk shares, but I'm having a few issues with that.

OK.  :(

 

Since Samba put them into the .RecyledBin folder I thought the hard work had been done and it would probably just be a case of the plugin cycling through the disks as well looking for .RecycledBin folders when working out what to trash.  Obviously it is not as easy as it first appears  :)

 

It's not as much a technical issue as making sense for the user.  I didn't think that deleting files at the disk share was something that people did.  I guess I don't understand why one would do that.

 

I want to get the webgui to browse all the recycle bins.  I can't get the built in browser to browse /mnt/user/*/.Recycle.Bin and /mnt/disk*/.Recycle.Bin at the same time.  I don't think it's meant to handle that.  So I will have to set up a way to browse each one separately.

 

Well actually at least 3 tabs, if you include the Flash device. Then maybe 1 more for all Unassigned Devices or one per unassigned device?

 

I am working on what might be a good solution to include disk shares, the flash share, and unassigned devices shares.

 

Perhaps take the cheap way out and have 2 tabs / sections (depending on the users preferences), one for User Shares and one for Disk Shares? This is similar to how the UI already splits the two shares  (user and disk) in the settings screen.

 

Link to comment

It's not as much a technical issue as making sense for the user.  I didn't think that deleting files at the disk share was something that people did.  I guess I don't understand why one would do that.

I was doing some reorganisation of files between disks.  I was deliberately not working at the user share level while doing this as I wanted precise control over where files ended up.

 

When adding new material to the share I normally do it via User Shares and not Disk Shares.

Link to comment

Just noticed an anomaly!

 

If you have Disk shares enabled and go in via a disk share to delete files then you end up with ./RecycledBin folder at the top level containing all the files.  This seems reasonable as that is the level of share I was using.    However if you now go to Settings->RecycleBin it claims the recycle bin is empty and using the option to empty the trash does nothing.

 

It looks as if .RecycleBin folders at the disk level are not being seen?  I believe that you need to check for .RecycleBin folders at both the disk and share level to rectify this?

 

It's not an anomaly.  The only shares managed at the Settings->RecycleBin are the user shares at /mnt/user/.  Any shares not mounted at /mnt/user have to be managed manually.  Click the 'Help' button for more information on the Settings->RecycleBin.  I would like to include the disk shares, but I'm having a few issues with that.

OK.  :(

 

Since Samba put them into the .RecyledBin folder I thought the hard work had been done and it would probably just be a case of the plugin cycling through the disks as well looking for .RecycledBin folders when working out what to trash.  Obviously it is not as easy as it first appears  :)

 

It's not as much a technical issue as making sense for the user.  I didn't think that deleting files at the disk share was something that people did.  I guess I don't understand why one would do that.

 

I want to get the webgui to browse all the recycle bins.  I can't get the built in browser to browse /mnt/user/*/.Recycle.Bin and /mnt/disk*/.Recycle.Bin at the same time.  I don't think it's meant to handle that.  So I will have to set up a way to browse each one separately.

 

Well actually at least 3 tabs, if you include the Flash device. Then maybe 1 more for all Unassigned Devices or one per unassigned device?

 

I am working on what might be a good solution to include disk shares, the flash share, and unassigned devices shares.

 

Perhaps take the cheap way out and have 2 tabs / sections (depending on the users preferences), one for User Shares and one for Disk Shares? This is similar to how the UI already splits the two shares  (user and disk) in the settings screen.

 

There are other shares to consider: flash, cache, and unassigned devices.  I'm going to do something similar to your idea.  I will still have one recycle bin, but you'll be able to browse shares by: User Shares, Disk Shares, Cache Share, Unassigned Devices Shares, and flash share.  Trash operations like empty the trash and remove aged files will manage all shares.

Link to comment

I keep getting a bunch of "test files" in the recycle bin.  Is there a fix for this?  Thanks for the plugin, great stuff!

 

I have no idea.  The recycle bin plugin does not generate any files.  Those files are coming from an application that is creating them and then deleting them.  Try to find out which share they are in and why they are being created.

Link to comment

New release today.  I finally got the browsing in the webgui the way I want it.  Click on the trash can and you can browse all shares in one place.  The shares are organized by Disk, Cache, User, Unassigned, and Flash.

 

You can update the plugin in the normal way, but you should click the "Default" settings button and then reset any preferences you have.  The files are no longer saved in the .Recycle.Bin folders by share by default.

 

I think this will make a lot more sense now because all the shares are browsed in one recycle bin and the share .Recycle.Bin contains the files without the share at the beginning of the file structure.

Link to comment

New release today.  I finally got the browsing in the webgui the way I want it.  Click on the trash can and you can browse all shares in one place.  The shares are organized by Disk, Cache, User, Unassigned, and Flash.

 

You can update the plugin in the normal way, but you should click the "Default" settings button and then reset any preferences you have.  The files are no longer saved in the .Recycle.Bin folders by share by default.

 

I think this will make a lot more sense now because all the shares are browsed in one recycle bin and the share .Recycle.Bin contains the files without the share at the beginning of the file structure.

 

There is a behavior of the webGui browsing that might be confusing.  The share will not show up in the webGui browse unless there is a .Recycle.Bin folder on the share.

 

Once a file has been deleted on the share, the .Recycle.Bin folder is created and you'll be able to see the share in the webGui browse.

Link to comment

Release 2015.09.27 just posted.  The last major change I wanted to make was how the cron was set up to run the weekly removal of aged files.  The original setup was to modify the crontab, which I really didn't care for.  I don't think a plugin should make changes in the crontab.  I converted to the dynamix cron system.

 

In order to upgrade, stop the Recycle Bin and then update.  If you don't stop the Recycle Bin first you will end up with the crontab entry to run the weekly script along with the dynamix entry.  Stopping the Recycle Bin first will remove the crontab entry.

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.