.. -*- coding: utf-8; indent-tabs-mode: nil; -*-

fzfs-copy-tree
==============

.. program:: fzfs copy-tree


Synopsis
--------

**fzfs copy-tree** [**-A**] [**-M** `mountpoint`] [**-k**] [**-n**] [**-u**] `source-dataset` `dest-dataset`


Description
-----------

Copy the ZFS filesystem or snapshot that is rooted at `source-dataset`
and all descendent datasets to the destination rooted at `dest-dataset`.

The structure, content and properties of the filesystems are copied.
The properties `canmount` and `mountpoint` are handled specially.

If `source-dataset` is a snapshot then all of its child datasets also must
have a snapshot with the same snapshot name.

`dest-dataset` must not exist already.

By default `canmount` is also copied. But this can be modified with
option :option:`-A`.

The `mountpoint` property is not copied. Normally it will be inherited
as the ZFS rules for `dest-dataset` regarding its parent are applied.
This can be changed with :option:`-M mountpoint`. Child datasets always
will inherit their mountpoint from `dest-dataset`.


Options
-------

.. option:: -A

   Unconditionally set the ZFS property `canmount=noauto` for all
   created datasets in the destination tree, `unless` the source dataset
   has `canmount=off`. If not given then `canmount` is copied from the
   source to the destination.

.. option:: -M <mountpoint>

   Set the `mountpoint` property for the destination root `dest-dataset`
   to `mountpoint`. All children will be set to inherit it.

   If not given then the mountpoint will we inherited by normal ZFS
   inheritance from the destination's parent.

.. option:: -k

   When copying from a snapshot source a corresponding snapshot will be
   copied to the target dataset. By default this snapshot will be
   deleted. With this option this snapshot is kept.

.. option:: -n

   Dry-run. Do not really create and copy datasets but show what would
   be done.

.. option:: -u

   Do not mount the copied datasets automatically when they are created.


Implementation Notes
--------------------

The current implementation uses :manpage:`zfs-send(8)`
and :manpage:`zfs-receive(8)` to implement the actual copying.


Environment
-----------

All environment variables that affect :command:`zfs` are effective also.


See Also
--------

:manpage:`fzfs(8)`, :manpage:`fzfs-create-tree(8)`
