Jump to content

Recommended Posts

Posted

I will be having family use my server for backing stuff up and as we all know end users always end up accidently deleting things and then wanting them back. Luckily, TrueNAS has a recycle bin option and hopefully HexOS can add it in one day as a setting that can just be turned on.

 

For anyone who finds this and wants to do it, here are the steps:

Set up the folder in the HexOS UI and then in the TrueNAS UI go to: Shares > Click edit on the SMB you want to add the recycle bin too > Purpose = No Presets > Click Advanced Options > Scroll to Other Options > Check Export Recycle Bin

Then you will want to set up a job to automatically empty your recycle bin:

Navigate to Chron Jobs in the TrueNas UI (just search for it but it's under System > Advanced Settings). Click add then you can either enter this into the command field as ONE LINE or save it to a file

find /mnt/HDDs/FOLDER/.recycle/* -atime +30 -delete;
find /mnt/HDDs/FOLDER/.recycle/* -depth -type d -empty -delete;
  • If you want to test to see what files will be deleted with this command run it without the "-delete"

If you save it to a file (like I did) you will enter this as the command.

sh /mnt/HDDs/PATH_TO_FILE/empty_recycle_bin.sh

Then just fill out the description, run as truenas_admin, and how often you want it to run and you are good to go.

 

Hope this helps and hopefully it can just be a 1 click type of setup in the future!!

 

P.S. Here is what the commands do:

The first command searches for files and directories in /mnt/HDDs/FOLDER/.recycle/ that have not been accessed in the last 30 days and deletes them.
The second command searches for empty directories in /mnt/HDDs/FOLDER/.recycle/ and deletes them.

Also commands were stolen from here

 

  • Like 1
  • Thanks 2
Posted

Just discovered that after enabling the recycle bin I had to restart the server in order to actually get the folder to appear. So if you don't see the ".recycle" folder restart your server, hopefully that will fix it.

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.   Paste as plain text instead

  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.

×
×
  • Create New...