Quantcast
Channel: Admins Goodies » freebsd
Viewing all articles
Browse latest Browse all 10

What does zfs receive -F do?

$
0
0

Question

When I read man zfs for zfs 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?

Asked by Sandra

Answer

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 to zfs 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.

Answered by syneticon-dj

Viewing all articles
Browse latest Browse all 10

Trending Articles