ZFS zfs Snapshot of FileSystem Doesn't Contain Data of FileSystems Below It

Question. I have a zpool called "zjail", with a zfs file system mounted on it at /zjail. Other file systems are created and mounted at /zjail/jail1 /zjail/jail2 etc. So zfs list -t all looks something like this:

Code:
root@dom0:~ # zfs list -t all | grep zjail
zjail                        2.08G  1.75T   112K  /zjail
zjail@Nov21                    72K      -   104K  -
zjail/0kde                    220K  1.75T   152K  /zjail/0kde
zjail/media                  29.4M  1.75T  29.4M  /zjail/media
zjail/social                 1.84G  1.75T  1.84G  /zjail/social

I was looking to recover a jail I had accidentally deleted, but when I checked /zjail/.zfs/snapshots/@Nov21 there were only a list of directories corresponding to the zfs file systems, but no actual data.
So I'm guessing that zfs snapshots of parent directories doesn't actually save zfs file systems mounted at that directory? Just regular files/directories?
 
Snapshots work on a per-dataset level, so in the above example you've only created a snapshot for zjail, not the underlying datasets. If you wanted to do that you'd need to use the -r parameter: # zfs snapshot -r zjail. See also zfs(8).

(edit)

Also... snapshots don't protect you from deleted filesystems/datasets because as soon as you remove a dataset you'd also remove all associated snapshots. The only way to protect yourself against this is an offsite backup. For that you should look into # zfs send (and receive). Also covered in the previously mentioned manual page.
 
Back
Top