tmux (like
screen) let's you run processes in separate sessions. These sessions continue to exist in the background. You can create, kill, list, enter, and exit tmux sessions.
This cheat sheet makes for a good bookmark and guide. (
CTRL + B is your friend!)
---
ZFS has a feature called a "resume token". Upon the first (or subsequent) run of a "zfs recv" command, the
-s flag instructs the
receiving dataset (the "destination" of the transfer) to
periodically generate a unique resume token. (I think it
updates its resume token every 10 seconds, or something like that.)
You can manually view the resume token on the destination dataset like so:
zfs get receive_resume_token newpool/mydata
It's a very long string! It contains the information needed to resume a ZFS send/recv, and it supersedes the subsequent "zfs send" options (because you cannot change any "send options" for a resumed transfer.)
---
Your first attempt to send/recv might look something like this (notice there is no
-t flag on the send, but there is a
-s flag on the recv):
zfs send -w -R oldpool/mydata@migrate_2022-05-21_00-00 | zfs recv -v -s -d -F newpool
However, if it is interrupted and you wish to resume without starting all over, you can invoke the
-t flag on the send side, which tells it to use a "resume token" found on the destination dataset (notice the recv side
always invokes the
-s flag, but the send side
only invokes
-t,
without all the other options, nor snapshot names, nor pool names, nor dataset names, etc):
zfs send -t `zfs get -H receive_resume_token newpool/mydata | cut -f3` | zfs recv -v -s -d -F newpool
If you look closely, you'll see I embedded a command within a command. This is because the
-t flag needs only the
pure resume token string without extraneous fields or words.
To test this yourself, you can see the string without extraneous fields like so:
zfs get -H receive_resume_token newpool/mydata | cut -f3
In fact, during a send/recv transfer, you can watch in real-time this string continuously update:
watch -n 10 "zfs get -H receive_resume_token newpool/mydata | cut -f3"