Playing with ZFS bookmarks

Status
Not open for further replies.

panz

Guru
Joined
May 24, 2013
Messages
556
Just experimenting a bit today :)

I noticed that feature@bookmarks and feature@extensible_dataset are enabled and active.

1) Now I can bookmark a snapshot (i.e. @20140717-0941 in the test Dataset of the tank pool) with:

Code:
zfs bookmark tank/test@20140717-0941 tank/test#20140717-0941


2) next step is taking a new snapshot of the same dataset (tank/test@20140717-1209)

3) now let's send the incremental from the bookmark

Code:
zfs send -Rv -i tank/test#20140717-0941 tank/test@20140717-1209 | zfs receive -Fdv backup


getting error

Code:
Error: Unsupported flag with filesystem or bookmark.
cannot receive: failed to read from stream
 

jamiejunk

Contributor
Joined
Jan 13, 2013
Messages
134
Our live storage is much smaller than our backup that we replicate to. So i'd like to be able to keep snapshots on the backup much longer than the live storage. I think bookmarks is the way to do this. Interested to see how your bookmark adventure turns out.
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
Bookmarks are basically checkpoints. To quote the zfs man page:
Bookmarks mark the point in time when the snapshot was created, and can be used as the incremental source for a zfs send command.
and to further quote the Illumos issue page:
Bookmarks can be used for incremental sends even when the starting snapshot has already been deleted (as long as the snapshot was bookmarked before being delete), meaning that you can free all the data associated with the snapshot.

So to reiterate Bookmarks are checkpoints without the preserved data blocks of a snapshot, or the metadata of a snapshot if you want to be pedantic. They are designed exactly for this kind of usage case: Keeping the snapshots on the receive side but deleting them on the local and still being able to sync.
 

panz

Guru
Joined
May 24, 2013
Messages
556
@DaPlumber Did you try any replication? I know the theory, I'm trying to put it into practice :)
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
@DaPlumber Did you try any replication? I know the theory, I'm trying to put it into practice :)

I know, I was simply pontificating for the bystanders. ;)

I've never done it with FreeNAS, and I've only ever seen it done "over the shoulder" so I may have missed something. :confused:

Anyhoo: The same restrictions apply as to a snapshot, does your example work with a snapshot? The syntax and conditions should be exactly the same, just use the bookmark name in place of the snapshot name.

Aside: I really need to find another disk or two for a sandbox in my FreeNAS. To be used in all my copious free time of course... :rolleyes:
 

panz

Guru
Joined
May 24, 2013
Messages
556
Yes the syntax is exactly the same, except that I bookmarked the snapshot before (and checked that the bookmark was created) and used it as the source for incremental replication. This is a real pool and not a VM.
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
Yes the syntax is exactly the same, except that I bookmarked the snapshot before (and checked that the bookmark was created) and used it as the source for incremental replication. This is a real pool and not a VM.

I think you need to do it the other way around: e.g. snapshot the pool, send/receive the snapshot, bookmark, delete the source snapshot and the send/receive the bookmark.

IOW the bookmark has to be a child of something already on the receiving end if I understand the syntax correctly?
 

panz

Guru
Joined
May 24, 2013
Messages
556
Take and send the first snapshot
change some files
Take the second snapshot
bookmark the first snapshot
Delete the first snapshot
Send / recv the incremental stream
Fail :(
 

DaPlumber

Patron
Joined
May 21, 2014
Messages
246
Take and send the first snapshot
change some files
Take the second snapshot
bookmark the first snapshot
Delete the first snapshot
Send / recv the incremental stream
Fail :(

Hmmm. Can you try bookmarking the 2nd snapshot after changes, then deleting both snapshots, then trying to send the bookmark?

The thinking is that that bookmark should be a child of the first snapshot and with deltas to send, i.e. effectively a virtual 2nd snapshot. Just spitballing here.
 

panz

Guru
Joined
May 24, 2013
Messages
556
The idea is that the bookmark is going to replace the "source" snapshot. I think that I'm missing something about features that I have to enable.
 
Status
Not open for further replies.
Top