ZFS ZFS snapshot root

jbodenmann

Well-Known Member

Reaction score: 159
Messages: 320

Is it possible to create & rollback a snapshot directly on the pool level? Or does this need to happen on the dataset level. Basically:
zfs snapshot -r zpool@mybackup

I noticed behavior on my "new" FreeBSD laptop that I would currently describe as "unexpected".
My procedure:
$> zfs snapshot -r zpool@mybackup
$> echo > "Hello World" ~/foo.txt
$> zfs rollback -R zpool@mybackup
$> cat ~/foo.txt

When running the last (4th) command I expect the shell to report that the file ~/foo.txt does not exist anymore as I'd expect it to vanish when rolling back to the snapshot taken prior to the file's creation. However, the shell just happily prints Hello World.

What (obvious?) thing am I missing here?
 

Matlib

Member

Reaction score: 33
Messages: 38

zfs rollback does not act recursively. Once recursive snapshot is created the snaps continue to live on their own. With the third command you rolled back only /zpool. The rollback -r and -R command line options stand for “recent”.

Appearantly there is no command to do a recursive rollback even if all sub-zfs have a snapshot with the that name.
 
D

Deleted member 63539

Guest


Is it possible to create & rollback a snapshot directly on the pool level? Or does this need to happen on the dataset level. Basically:
zfs snapshot -r zpool@mybackup

I noticed behavior on my "new" FreeBSD laptop that I would currently describe as "unexpected".
My procedure:
$> zfs snapshot -r zpool@mybackup
$> echo > "Hello World" ~/foo.txt
$> zfs rollback -R zpool@mybackup
$> cat ~/foo.txt

When running the last (4th) command I expect the shell to report that the file ~/foo.txt does not exist anymore as I'd expect it to vanish when rolling back to the snapshot taken prior to the file's creation. However, the shell just happily prints Hello World.

What (obvious?) thing am I missing here?
I think only the dataset level. I have never seen anyone doing a zpool snapshot.
Could you post the output of zfs list -t snapshot?
 

jjthomas

Active Member

Reaction score: 7
Messages: 112

I came here seeking an answer to the same question, with the same results.

My question is what do, to have ZFS back up and restore my whole drive? Including /root

-JJ
 
Top