`zfs send` 报告的大小是准确的还是估计的?

Rya*_*n J 6 zfs zfsonlinux

考虑以下命令和输出:

zfs send -Pvi \
    tank/vms/langara@zfsnap-2016-05-11_00.00.00--1w \
    tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w \
        | dd  > /dev/null
Run Code Online (Sandbox Code Playgroud)

运行 1:

incremental   zfsnap-2016-05-11_00.00.00--1w tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w    4903284160
size 4903284160
17:29:42   1244483472  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:29:43   2487508120  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:29:44   3741453864  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
9582310+895 records in
9582799+1 records out
4906393272 bytes (4.9 GB) copied, 3.94883 s, 1.2 GB/s
Run Code Online (Sandbox Code Playgroud)

运行 2:

incremental   zfsnap-2016-05-11_00.00.00--1w tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w    4903284160
size 4903284160
17:30:07   1209666712  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:30:08   2411042632  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:30:09   3632274072  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:30:10   4853372344  tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
9582450+654 records in
9582799+1 records out
4906393272 bytes (4.9 GB) copied, 4.05346 s, 1.2 GB/s
Run Code Online (Sandbox Code Playgroud)

在没有-P选项的情况下运行:

total estimated size is 4.57G
TIME        SENT   SNAPSHOT
17:36:23   1.11G   tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:36:24   2.25G   tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:36:25   3.39G   tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
17:36:26   4.50G   tank/vms/langara@zfsnap-2016-05-13_00.00.00--1w
9582443+679 records in
9582799+1 records out
4906393272 bytes (4.9 GB) copied, 4.01077 s, 1.2 GB/s
Run Code Online (Sandbox Code Playgroud)

我有 4 个相关问题。

  1. -P开关中列出的初始尺寸是估计值吗?我认为它与没有-P开关的情况相同,但没有说明它是估计值。
  2. zfs send一旦发送完成,有没有办法输出实际的流大小?
  3. 有什么方法可以zfs send通过使用现有的 ZFS 属性计算出估计的流大小,还是干运行发送是唯一的方法?
  4. 是否有类似logicalwritten(注意:不是真实财产)的东西可以为我提供与written财产相同的信息,但使用未压缩的大小?

use*_*391 3

  1. 我从手册页描述中判断Print machine-parsable verbose information about the stream package generated,它是相同的信息,只是格式更好(例如,字节而不是转换为 KB/MB/GB)。另外,从您的示例 4903284160/1024^3~=4.566 中,四舍五入为 4.57,结果如下。
  2. 看看这个 Oracle 文档,可能会有所帮助:

    Use the following dry-run syntax to estimate the size of the snapshot stream but not send it.
    # zfs send -rnv tank/source@snap1
    estimated stream size: 10.0G
    
    You can monitor the progress of the send stream by inserting the pv command between the zfs send and the zfs receive commands. [...] When the snapshot stream is completely received, the progress monitor identifies the total size received. For example:
    # zfs send tank/source@snap1 | pv |zfs recv pond/target
    10GB 0:01:55 [88.5MG/s] [       <=>   ]
    
    Run Code Online (Sandbox Code Playgroud)

    Solaris 11.3还引入了一些新的监控功能send/recv未来illumos/OpenZFS可能会采用类似的功能。

  3. 估计尺寸已经有了,您是指实际尺寸吗?遗憾的是,无法获得实际尺寸,有关详细信息,请参阅此线程
  4. 或许logicalused?从FreeBSD 手册zfs(illumos 也有该属性,但手册页缺少描述):

    logicalused
    
    The amount of space that is "logically" consumed by this dataset and
    all its descendents.  See the used property.  The logical space
    ignores the effect of the compression and copies properties, giving a
    quantity closer to the  amount of data that applications see.
    
    Run Code Online (Sandbox Code Playgroud)