SMB Recycle and Snapshots

I just want to confirm that SMB Recycle itself doesn’t create snapshots. Somebody asked a question elsewhere about deleting files and, while replying, I realized that I was not 100% sure what TrueNAS was doing at the ZFS level with Recycle.

I assume that files in Recycle are just “shadow deleted” in ZFS and therefore don’t get treated any differently in snapshots than if the file had just been copied to a different folder in the dataset. The file will be retained in Recycle in subsequent snapshots until it gets deleted from Recycle.

Is that correct?

It’s the recycle module in samba itself. ZFS has nothing to do with that.

Right, the SMB recycle bin doesn’t create snapshots. It just moves deleted files to a hidden .recycle directory at the root of the dataset. From ZFS’s perspective, they’re simply relocated files that get included in snapshots like anything else (at the new location, the old one is really deleted).

There are some oddities with it that can catch users off guard too. It creates per-user directories at the dataset root (of wherever the user happens to be at the time–meaning it doesn’t always put files in the same location), it’s not integrated with client OS recycle bins which can cause confusion if the user expects that, and it’s fairly easy to do something like reset permissions on the parent dataset and accidentally expose the .recycle directories to other users or remove access for the correct user.

That’s why using regular ZFS snapshots is a better solution.

1 Like