zfsonlinux recently added support for visible .zfs snapshot directories, so you no longer have to mount a snapshot to browse/view/recover files from it.
This is good, but has caused my rsync backup to zfs script to complain about being unable to delete files in the .zfs directory (which is in the backup but not in the source).
sending incremental file list rsync: delete_file: unlink(.zfs/snapshot/2012-03-31/vmlinuz.old) failed: Read-only file system (30) rsync: delete_file: unlink(.zfs/snapshot/2012-03-31/vmlinuz) failed: Read-only file system (30) [...] cannot delete non-empty directory: .zfs/snapshot/2012-03-31 rsync: delete_file: rmdir(.zfs/snapshot/2012-03-31) failed: Device or resource busy (16) rsync: delete_file: unlink(.zfs/snapshot/2012-03-30/vmlinuz.old) failed: Read-only file system (30) rsync: delete_file: unlink(.zfs/snapshot/2012-03-30/vmlinuz) failed: Read-only file system (30) [...]
The solution is to tell rsync to ignore .zfs directories on the destination.
1. use the -F option to make rsync use /.rsync-filter
2. create or add the following line to /.rsync-filter
-r .zfs/*** -s .zfs/***
On the first line, the ‘-‘ makes it an exclude rule, and the ‘r’ indicates that the rule applies to the receiving side. Together, ‘-r’ prevents rsync from attempting to delete the .zfs directories
On the second line, the ‘-s’ indicates that the rule applies to the sending side, preventing rsync from trying to backup any .zfs snapshot directories. This is only useful when backing up a ZFS filesystem.