COLLECTFS - COLLECT FILESYSTEM
Version 1.0

Copyright 2011, Michael Hamilton
http://codeincluded.blogspot.com/
GPL 3.0(GNU General Public License) - see COPYING file

Collectfs is a userspace filesystem that provides add-on trash collection 
for a directory hierarchy.  

WHAT'S IT FOR:

My main intent is to protect a project hierarchy by providing a fairly 
universal no-clobber mechanism:
  - The history of changes is preserved. 
  - Missteps in using rm, mv, cat, etc are non-permanent.
  - It works seamlessly with standard development tools.

Collectfs can be used much like the edit history system in development tools 
like eclipse, but is more universal and doesn't dictate the tool-set.

WHAT IT PROTECTS YOU FROM:

Any file that is overwritten by remove (unlink), move, link, symlink, or 
open-truncate is relocated to a trash directory.  Removed files are 
date-time stamped so that edit history is maintained.

WHAT IT DOESN'T PROTECT YOU FROM:

Any file that is updated in place is not protected.  So it's not going to
protect you from dropping database tables.

It isn't aware of cross file dependencies that some tools may require for
a set of files to be consistent and usable.

HOW IT WORKS:

The fuse layer traps the previously mentioned filesystem operations and
renames clobbered files to a trash directory.  The trash directory
duplicates the structure (but not permissions) of the original directory 
to provide some context for recovery.  Using rename is fast requiring
no data to be copied.  Because collectfs relies on using rename, the 
trash directory must reside within the same physical filesystem. 

USAGE:

See collectfs.1 - also included as collectfs.1.man and collectfs.1.html
(e.g. less -r collectfs.1.man )

CREDITS:

http://fuse.sourceforge.net/

http://www.cs.nmsu.edu/~pfeiffer/fuse-tutorial/
Joseph J. Pfeiffer
A great place to start - includes a complete example filesystem: the
bbs filesystem that just logs all operations as it forwards them to
the underlying Linux filesystem.

http://sysdocs.stu.qmul.ac.uk/sysdocs/Comment/FuseUserFileSystems/
John Cobb & Radek Podgorny
More good examples.