recycle.ko

A Linux kernel module which moves all files unlinked under a root directory to a recycle directory.

This module was inspired by the Samba vfs_recycle module but works with directory trees shared via NFS (or not shared at all).

It works by using ftrace to hook the security_inode_unlink function (which is called before the kernel performs an unlink) and adding a hard-link to the inode of the file about to be deleted to an equivalent path under the recycle directory.

It is probably worth bearing in mind that this is my first kernel module so I can’t guarantee that it won’t crash your machine or eat all of your data etc. However, I do run it on the server which stores my personal files - hopefully that demonstrates my confidence.

Note that this module hasn’t been implemented to work with delegated inodes (e.g. directories mounted via NFS on a client), I’d recommend using it on the NFS server side instead.

recycle.ko is free to use and open source, licensed under the terms of the GPL. You can browse or download the source at the GitHub repository.

Download Version 0.2

Latest News

New Release: recycle.ko 0.2

For full details and to download this release, see the recycle.ko page.

New Project: recycle.ko

I’ve written a new Linux kernel module inspired by the Samba vfs_recycle module but to work more generally with any local file system.

It is currently tested and working with Ubuntu 24.04 and a DKMS .deb package is available for Debian-based distros. For more information, check out the project page.

Questions or Problems?

For more information see the help page. If you have found a problem then you can report a bug. If you still have questions, feel free to get in touch.