Samba and the Recycle Bin

By hernil

ZFS snapshots might make the good old Recycle Bin a bit superfluous but sometimes knowing what was deleted is the first step in restoring it. Here is the config needed to enable the Samba recycle module that moves deleted files in seperate folder for you to manage later on.

vfs objects = recycle
recycle:repository = .recycle/%U
recycle:directory_mode = 0550
recycle:subdir_mode = 0550
recycle:keeptree = yes
recycle:touch = yes
recycle:versions = yes
  • The %U syntax means that deleted files are ordered by the user that deleted them
  • keeptree recreates the file path in the recycle folder so you know where it came from
  • touch updates the file access time with the deletion timestamp
  • versions will keep multiple versions if files with the same name (and path) are deleted again

There are also ways to set min and max file sizes that should be included in the bin as well as exclution patterns for file paths. See the docs for more info.

Gotchas

  • This will not be integrated into the native Windows recycle bin
  • Deleted files will not free up disc space until they are deleted by a server admin
  • the repository has to be within the same file system boundary as the file share. This means that it has to recide within the same ZFS dataset. In other words you cannot have a common recycle bin for many network shares if they each recide on seperate datasets. This can be the source of files simply “vanishing” during the deletion process.

Sources

Sambe recycle docs


Input or feedback to this content?
Reply via email!
Related Articles