linux – 无法发送zfs | zfs在同一个zpool中接收数据集

我有两个环境Staging(staging)和Development(choang).我无法将数据集zfs / staging.assets中的(包括快照)复制到同一zpool zfs中的另一个数据集zfs / choang.assets.

注意:我假设我需要卸载原始数据集和目标数据集.

zfs unmount zfs/staging.assets
zfs unmount zfs/choang.assets

zfs send -R zfs/staging.assets | zfs receive -F zfs/choang.assets

执行时,上述命令会生成以下错误:

Error: Unsupported flag with filesystem or bookmark.
cannot receive: failed to read from stream

当我删除-R选项并执行命令时,它成功:

zfs send zfs/staging.assets | zfs receive -F  zfs/choang.assets

但是,不会收到任何快照,并且会创建一个快照zfs/choang.assets@–head–.

最后,我试图发送快照 – 想想也许我可以一次发送一个快照:

zfs send zfs/staging.assets@sha512_hash | zfs receive -Fduv zfs/choang.assets

这也不起作用并产生以下错误:

internal error: Invalid argument
cannot receive: failed to read from stream

如何复制所有快照?

解决方法:

在ZFS上使用发送/接收,您只能将其用于快照,而无需卸载数据集.您将无法发送/接收音量.

The zfs send command creates a stream representation of a snapshot
that is written to standard output. By default, a full stream is
generated. You can redirect the output to a file or to a different
system. The zfs receive command creates a snapshot whose contents are
specified in the stream that is provided on standard input. If a full
stream is received, a new file system is created as well. You can send
ZFS snapshot data and receive ZFS snapshot data and file systems with
these commands.

正确的命令是:

zfs send tank/data@snap1 | zfs recv spool/ds01

发送/接收zfs快照的更好方法是使用mbuffer来最小化I / O延迟的风险并填满网络缓冲区.

在发送机器上:

zfs send pool/image@test | mbuffer -s 128k -m 1G -O 127.0.0.1:9090

在接收机器上:

mbuffer -s 128k -m 1G -I 9090 | zfs receive -F pool/image1

您可以将127.0.0.1用于同一台计算机,或者将xx.xx.xx.xx用于远程计算机.

资料来源:https://docs.oracle.com/cd/E18752_01/html/819-5461/gbchx.html

上一篇:flutter 网络请求以及数据处理


下一篇:对snapshot isolation和write-snapshot isolation的一些思考