Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

up vote 12 down vote accepted

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.

share|improve this answer
1  
One 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. –  Josh May 29 '13 at 16:16
    
@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 to zfs send. I believe the information about other snapshots possibly present on the source is not even part of the stream zfs send -i is producing. –  the-wabbit Jun 26 '13 at 13:22

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.