当我在数据集上运行此查询时
zfs list -d 1 -t all -o name,used,refer,written,compressratio sfg-backup/mx
我看到以下统计数据:
zfs list -d 1 -t all -o name,used,refer,written,compressratio sfg-backup/mx
NAME USED REFER WRITTEN RATIO
sfg-backup/mx 300G 276G 0 1.80x
sfg-backup/mx@madcow_2023-04-15_23:15:00_UTC 4.04G 275G 275G 1.28x
...
sfg-backup/mx@madcow_2023-04-21_01:15:00_UTC 0B 276G 0 1.28x
sfg-backup/mx@madcow_2023-04-21_02:15:00_UTC 0B 276G 4.26G 1.28x
sfg-backup/mx@madcow_2023-04-21_03:15:00_UTC 0B 276G 0 1.28x
但是,当我运行备份时,它有最后一个快照,因为madcow_2023-04-21_01:15:00_UTC
备份的大小不是 4.26GB,而是 31.4GB
syncoid --no-sync-snap 10.0.1.2:sfg-backup/mx work/sfg/mx
NEWEST SNAPSHOT: madcow_2023-04-21_03:15:00_UTC
Sending incremental sfg-backup/mx@madcow_2023-04-21_01:15:00_UTC ... madcow_2023-04-21_03:15:00_UTC (~ 31.4 GB):
31.5GiB 0:03:16 [ 163MiB/s] [==================================================================================================>] 100%
添加-c
压缩后大小变为 4.3G(这些是略有不同的快照,但内容大致相同。
zfs send -nv -c -I sfg-backup/mx@madcow\_2023-04-24\_00:15:00\_UTC sfg-backup/mx@madcow\_2023-04-24\_03:15:00\_UTC
send from @madcow_2023-04-24_00:15:00_UTC to sfg-backup/mx@madcow_2023-04-24_01:15:00_UTC estimated size is 215M
send from @madcow_2023-04-24_01:15:00_UTC to sfg-backup/mx@madcow_2023-04-24_02:15:00_UTC estimated size is 4.09G
send from @madcow_2023-04-24_02:15:00_UTC to sfg-backup/mx@madcow_2023-04-24_03:15:00_UTC estimated size is 624B
total estimated size is 4.30G
# without -c flag:
zfs send -nv -I sfg-backup/mx@madcow\_2023-04-24\_00:15:00\_UTC sfg-backup/mx@madcow\_2023-04-24\_03:15:00\_UTC
send from @madcow_2023-04-24_00:15:00_UTC to sfg-backup/mx@madcow_2023-04-24_01:15:00_UTC estimated size is 216M
send from @madcow_2023-04-24_01:15:00_UTC to sfg-backup/mx@madcow_2023-04-24_02:15:00_UTC estimated size is 31.3G
send from @madcow_2023-04-24_02:15:00_UTC to sfg-backup/mx@madcow_2023-04-24_03:15:00_UTC estimated size is 624B
total estimated size is 31.5G
您能帮我理解一下是什么原因导致了这种巨大的尺寸差异吗?为什么 ZFS 报告的压缩率为 1.28,而传输压缩率为 31.5/4.3=7.3?
答案1
WRITTEN
节目压缩实际写入数据集/快照的数据。在和之间sfg-backup/mx@madcow_2023-04-21_01:15:00_UTC
,madcow_2023-04-21_03:15:00_UTC
您将高度可压缩的数据写入先前不可压缩的数据之上,而无需取消引用整个文件。
我假设您有一些可以随机覆盖的大文件(即:虚拟磁盘映像文件、数据库等),而恰巧您写入了 32G 的原始数据,而这些数据变成了 4G 的压缩数据。
zfs send -c
按原样发送压缩记录,仅传输压缩的 4G 增量。另一方面,zfs send
(不带-c
)会解压缩磁盘上的数据,将其扩展为完整的 32G 大小。