Rockstor Recycle BIN

Hello,

Does rockstor has a recycle bin like asustor, synology etc? tried to search for recycle bin but couldnt find a thing.

Thanks

I should probably pick up a Synology box for reference… but could you explain the recycle bin feature in detail?

Of course, what I meant by recycle bin is that on Synology boxes, ASUSTOR etc you can choose the following option. When one of your NAS clients deletes a file from the share it automatically goes to a folder called recycle Instead of being permanently deleted. This way the administrator that has only access to this folder can retrieve files from there.

Regards

HI Suman, any feedback on this?

Thanks
Regards

Hi @davioxx & @suman,
recycle bin feature is a well documented samba option - samba manpages , also available via web ui on Sinology, freenas/nas44free, etc etc etc

@davioxx you can have it directly editing your samba custom params on Rockstor web ui

Do you think this could be a desired feature??
Desired = opening new issue and coding a user friendly recycle bin configurator inside Rockstor web ui :wink:

1 Like

Well at least for myself is a desired features as I have multiple users in my house and sometimes they accidentally delete files, I also use snapshots but that’s a different approach and is not easy for my users to review them.

Added on Rockstor developmente queue :wink:

2 Likes

I hope we are going to get this recycle bin soon. It is a must have.

How I enable the “Recycle Bin” on Rockstor SMB shares:

  1. Access the System Shell [ System —> _> System Shell ]
  2. Log in as the ‘admin’ user. Escalate to root account (with root’s environment)

su -

  1. Edit the smb.conf file – note: use cp smb.conf smb.conf.bak to make a backup of the original. Here I am usig the nano text editor, feel free to use vi or others as you like:

nano /etc/samba/smb.conf

Add the following lines to the [global] section:

vfs objects = recycle
recycle:keeptree = yes
recycle:versions = yes

Options:
recycle:keeptree = yes ### keeps parent directory structure when file deleted
recycle:versions = yes ### two files with the same name that are deleted will both be kept

  1. Save the smb.conf file
  2. Restart the smb service

systemctl restart smb

There are other options such as defining the path to the recycle directory. I choose the default directory .recycle

Few things:

  1. If you only wanted particular shares to have the .recycle function, place them in the [ share ] section of the smb.conf vs. the [ global ] section.
    See: https://www.samba.org/samba/docs/current/man-html/vfs_recycle.8.html
    for a good example

  2. A script to empty the .recycle directory via a cron job is easily possible. I choose not to as I use the .recycle directory for accidental deletion of files.

Ref:
https://www.samba.org/samba/docs/current/man-html/vfs_recycle.8.html
https://manpages.opensuse.org/Leap-15.6/samba/vfs_recycle.8.en.html

2 Likes

@johnc hello again. Thanks for the writeup on this. Instead of directly updating the smb.conf, you should be able to place these additional parameters directly into the Samba service or share definition (depending on whether the recycling bin should be active for all or just for individual shares). That way, the information is stored in the database and during configuration backups:

Global (under Services):

per share:

But, in general, be mindful on how multiple vfs objects are in play. If any other are added to the global or share section, the sequence is important, as samba doesn’t automatically know in which order it loads these modules, (e.g. antivirus should be before recycle). Specifically, if at the share level one wants to use the shadow copy functionality as well as the recycling bin, then the shadow copy piece cannot be enabled via the webui:

image

But needs to be also put into the custom configuration to ensure that all desired vfs objects (and their options) are loaded (and in the right sequence).

e.g.:

vfs objects = shadow_copy2 recycle
...
3 Likes

Thank you @Hooverdan !
This is a much better implementation, and given your much better write-up I plan to revert my smb.conf file and use your version. Especially since the config is captured during backups.

1 Like

While you responded I also added the caveat that comes with having multiple vfs objects in play in my above post.

1 Like

@Hooverdan In your first screenshot (for Global parameters), did you have other parameters defined before the red capture rectangle? Or are then ones you show the only ones applicable?
And thanks for the clarification on vfs objects = …
that one completely blew past me and I had to think about the Windows Clients’ shadow copies.

Some time ago I wrote up a configuration for “better works with Apple devices” here:

The list in the global config is “resorted” after saving, but works for me:

min protocol = SMB2
ea support = yes
vfs objects = catia fruit streams_xattr
fruit:delete_empty_adfiles = yes
fruit:metadata = stream
fruit:model = MacSamba
fruit:nfs_aces = no
fruit:posix_rename = yes
fruit:veto_appledouble = no
fruit:wipe_intentionally_left_blank_rfork = yes

Some are also using the btrfs as the very first vfs object but I have not seemed to have needed it w.r.t to working with snapshots, etc.

You might have to experiment a bit, but I think the recycle would come as the last vfs object in this list.

3 Likes

@Hooverdan The only parameter I changed in your global config is:

min protocol = SMB3

This is what is shown from macOS 13.7.8 (Ventura) – note: old MacBookPro

2 Likes

@johnc thanks for the update. Yes, you’re right, I think all my devices can handle that now, too. Time to move up the minimum requirements!

1 Like