.. include:: ../global.rst.inc Send & Recv Options =================== .. _job-send-options: Send Options ~~~~~~~~~~~~ :ref:`Source` and :ref:`push` jobs have an optional ``send`` configuration section. :: jobs: - type: push filesystems: ... send: # flags from the table below go here ... The following table specifies the list of (boolean) options. Flags with an entry in the ``zfs send`` column map directly to the zfs send CLI flags. zrepl does not perform feature checks for these flags. If you enable a flag that is not supported by the installed version of ZFS, the zfs error will show up at runtime in the logs and zrepl status. See the `upstream man page `_ (``man zfs-send``) for their semantics. .. list-table:: :widths: 20 10 70 :header-rows: 1 * - ``send.`` - ``zfs send`` - Comment * - ``encrypted`` - - Specific to zrepl, :ref:`see below `. * - ``bandwidth_limit`` - - Specific to zrepl, :ref:`see below `. * - ``raw`` - ``-w`` - Use ``encrypted`` to only allow encrypted sends. * - ``send_properties`` - ``-p`` - **Be careful**, read the :ref:`note on property replication below `. * - ``backup_properties`` - ``-b`` - **Be careful**, read the :ref:`note on property replication below `. * - ``large_blocks`` - ``-L`` - **Potential data loss on OpenZFS < 2.0**, see :ref:`warning below `. * - ``compressed`` - ``-c`` - * - ``embbeded_data`` - ``-e`` - * - ``saved`` - ``-S`` - .. _job-send-options-encrypted: ``encrypted`` ------------- The ``encrypted`` option controls whether the matched filesystems are sent as `OpenZFS native encryption `_ raw sends. More specifically, if ``encrypted=true``, zrepl * checks for any of the filesystems matched by ``filesystems`` whether the ZFS ``encryption`` property indicates that the filesystem is actually encrypted with ZFS native encryption and * invokes the ``zfs send`` subcommand with the ``-w`` option (raw sends) and * expects the receiving side to support OpenZFS native encryption (recv will fail otherwise) Filesystems matched by ``filesystems`` that are not encrypted are not sent and will cause error log messages. If ``encrypted=false``, zrepl expects that filesystems matching ``filesystems`` are not encrypted or have loaded encryption keys. .. NOTE:: Use ``encrypted`` instead of ``raw`` to make your intent clear that zrepl must only replicate filesystems that are actually encrypted by OpenZFS native encryption. It is meant as a safeguard to prevent unintended sends of unencrypted filesystems in raw mode. .. _job-send-options-properties: ``properties`` -------------- Sends the dataset properties along with snapshots. Please be careful with this option and read the :ref:`note on property replication below `. .. _job-send-options-backup-properties: ``backup_properties`` --------------------- When properties are modified on a filesystem that was received from a send stream with ``send.properties=true``, ZFS archives the original received value internally. This also applies to :ref:`inheriting or overriding properties during zfs receive `. When sending those received filesystems another hop, the ``backup_properties`` flag instructs ZFS to send the original property values rather than the current locally set values. This is useful for replicating properties across multiple levels of backup machines. **Example:** Suppose we want to flow snapshots from Machine A to B, then from B to C. A will enable the :ref:`properties send option `. B will want to override :ref:`critical properties such as mountpoint or canmount `. But the job that replicates from B to C should be sending the original property values received from A. Thus, B sets the ``backup_properties`` option. Please be careful with this option and read the :ref:`note on property replication below `. .. _job-send-options-large-blocks: ``large_blocks`` ---------------- This flag should not be changed after initial replication. Prior to `OpenZFS commit 7bcb7f08 `_ it was possible to change this setting which resulted in **data loss on the receiver**. The commit in question is included in OpenZFS 2.0 and works around the problem by prohibiting receives of incremental streams with a flipped setting. .. WARNING:: This bug has **not been fixed in the OpenZFS 0.8 releases** which means that changing this flag after initial replication might cause **data loss** on the receiver. .. _job-recv-options: Recv Options ~~~~~~~~~~~~ :ref:`Sink` and :ref:`pull` jobs have an optional ``recv`` configuration section: :: jobs: - type: pull recv: properties: inherit: - "mountpoint" override: { "org.openzfs.systemd:ignore": "on" } bandwidth_limit: ... # see below ... .. _job-recv-options--inherit-and-override: ``properties`` -------------- ``override`` maps directly to the `zfs recv -o flag `_. Property name-value pairs specified in this map will apply to all received filesystems, regardless of whether the send stream contains properties or not. ``inherit`` maps directly to the `zfs recv -x flag `_. Property names specified in this list will be inherited from the receiving side's parent filesystem (e.g. ``root_fs``). With both options, the sending side's property value is still stored on the receiver, but the local override or inherit is the one that takes effect. You can send the original properties from the first receiver to another receiver using :ref:`send.backup_properties`. .. _job-note-property-replication: A Note on Property Replication ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If a send stream contains properties, as per ``send.properties`` or ``send.backup_properties``, the default ZFS behavior is to use those properties on the receiving side, verbatim. In many use cases for zrepl, this can have devastating consequences. For example, when backing up a filesystem that has ``mountpoint=/`` to a storage server, that storage server's root filesystem will be shadowed by the received file system on some platforms. Also, many scripts and tools use ZFS user properties for configuration and do not check the property source (``local`` vs. ``received``). If they are installed on the receiving side as well as the sending side, property replication could have unintended effects. **zrepl currently does not provide any automatic safe-guards for property replication:** * Make sure to read the entire man page on zfs recv (`man zfs recv `_) before enabling this feature. * Use ``recv.properties.override`` whenever possible, e.g. for ``mountpoint=none`` or ``canmount=off``. * Use ``recv.properties.inherit`` if that makes more sense to you. Below is an **non-exhaustive list of problematic properties**. Please open a pull request if you find a property that is missing from this list. (Both with regards to core ZFS tools and other software in the broader ecosystem.) Mount behaviour --------------- * ``mountpoint`` * ``canmount`` * ``overlay`` Note: inheriting or overriding the ``mountpoint`` property on ZVOLs fails in ``zfs recv``. This is an `issue in OpenZFS `_ . As a workaround, consider creating separate zrepl jobs for your ZVOL and filesystem datasets. Please comment at zrepl :issue:`430` if you encounter this issue and/or would like zrepl to automatically work around it. Systemd ------- With systemd, you should also consider the properties processed by the `zfs-mount-generator `_ . Most notably: * ``org.openzfs.systemd:ignore`` * ``org.openzfs.systemd:wanted-by`` * ``org.openzfs.systemd:required-by`` Encryption ---------- If the sender filesystems are encrypted but the sender does :ref:`plain sends ` and property replication is enabled, the receiver must :ref:`inherit the following properties`: * ``keylocation`` * ``keyformat`` * ``encryption`` Common Options ~~~~~~~~~~~~~~ .. _job-send-recv-options-bandwidth-limit: Bandwidth Limit (send & recv) ----------------------------- :: bandwidth_limit: max: 23.5 MiB # -1 is the default and disabled rate limiting bucket_capacity: # token bucket capacity in bytes; defaults to 128KiB Both ``send`` and ``recv`` can be limited to a maximum bandwidth through ``bandwidth_limit``. For most users, it should be sufficient to just set ``bandwidth_limit.max``. The ``bandwidth_limit.bucket_capacity`` refers to the `token bucket size `_. The bandwidth limit only applies to the payload data, i.e., the ZFS send stream. It does not account for transport protocol overheads. The scope is the job level, i.e., all :ref:`concurrent ` sends or incoming receives of a job share the bandwidth limit.