What does zfs receive -F do?
Solution 1
The -F switch comes in handy if you have messed with the destination dataset after it has been received. Once you do any changes to it (including doing something as innocent as a directory listing as this would change atimes), it is no longer in the state it was in after the initial transfer. Trying to run a plain zfs receive
from an incremental data stream created by the other side's zfs send -i tank/dataset@old tank/dataset@new
would result in an error. In this case you have two options on the receiver side:
- you could either revert to the last snapshot manually using
zfs rollback
- or provide the
-F
switch tozfs receive
to let it handle that for you automatically
Of course, it might be a destructive operation, so you have to understand what it is doing before using it. But if all you are doing is copying snapshots over to a non-live "backup" destination where no other data is written to you might miss, it should be safe.
Solution 2
Others are the experts here on ZFS, I'll simply post this in case you haven't seen it.
Using this option might be necessary when the file system is modified between the time a rollback occurs and the receive is initiated.
From: Solaris - New zfds receive -F option
Related videos on Youtube
Sandra
Updated on September 18, 2022Comments
-
Sandra over 1 year
When I read
man zfs
forzfs receive
I see-F Force a rollback of the file system to the most recent snap- shot before performing the receive operation. If receiving an incremental replication stream (for example, one generated by "zfs send -R -Fi -iI"), destroy snapshots and file systems that do not exist on the sending side.
but I don't quite understand what
-F
actually will do.If I
zfs receive tank/pool
then the received snapshot is rolled back on the destination side file system, which is what I want.In which situations do I want to use
-F
? -
Josh almost 11 yearsOne thing I might add to this answer is the "-F" option I believe has the side effect of removing any snapshots on the target that no longer exist on the source. If you do a rollback, instead of using "-F" option, you can keep the snapshots on the target that no longer exist on the source.
-
the-wabbit almost 11 years@Josh while the documentation seems to suggest so, I have not yet seen this to be the case. At least on Solaris 11, target snapshots are not removed if they do not exist on source when using the
-i
option tozfs send
. I believe the information about other snapshots possibly present on the source is not even part of the streamzfs send -i
is producing.