Receiving a ZFS Snapshot

Keep the following key points in mind when you receive a file system snapshot:

  • Both the snapshot and the file system are received.

  • The file system and all descendant file systems are unmounted.

  • The file systems are inaccessible while they are being received.

  • A file system with the same name as the source file system to be received must not exist on the target system. If the file system name exists on the target system, rename the file system.

For example:

$ zfs send system1/gozer@0830 > /bkups/gozer.083006
$ zfs receive system1/gozer2@today < /bkups/gozer.083006
$ zfs rename system1/gozer system1/gozer.old
$ zfs rename system1/gozer2 system1/gozer

If you make a change to the destination file system and you want to perform another incremental send of a snapshot, you must first roll back the receiving file system.

Consider the following example. First, make a change to the file system as follows:

sys2$ rm newsys/hsolo/file.1

Then, perform an incremental send of system1/diant@snap3. Note that either you must first roll back the receiving file system to receive the new incremental snapshot or eliminate the rollback step by using the -F option. For example:

sys1$ zfs send -i system1/diant@snap2 system1/diant@snap3 | ssh sys2 zfs recv \
-F newsys/hsolo

When you receive an incremental snapshot, the destination file system must already exist.

If you make changes to the file system and you do not roll back the receiving file system to receive the new incremental snapshot or you use the -F option, a message similar to the following example is displayed:

sys1$ zfs send -i system1/diant@snap4 system1/diant@snap5 | ssh sys2 zfs recv \
newsys/hsolo
cannot receive: destination has been modified since most recent snapshot

The following checks are performed before the -F option is successful:

  • If the most recent snapshot does not match the incremental source, neither the rollback nor the receive is completed, and an error message is returned.

  • If you accidentally provide the name of different file system that does not match the incremental source specified in the zfs receive command, neither the rollback nor the receive is completed, and the following error message is returned:

    cannot send 'pool/fs@name': not an earlier snapshot from the same fs