我正在尝试在两台机器之间复制整个文件系统。
根据文档-R
,zfs send
应该
“生成一个复制流包,它将复制指定的文件系统以及所有后代文件系统,直到指定的快照。”
但我收到错误Error: Unsupported flag with filesystem or bookmark.
这是我的用例(我已经有zfs/logs
文件系统):
zfs create zfs/logs/project-1
zfs create zfs/logs/project-1/branch-1
zfs create zfs/logs/project-1/branch-2
dd if=/dev/urandom of=/zfs/logs/project-1/branch-1/test1.bin bs=16M count=16
dd if=/dev/zero of=/zfs/logs/project-1/branch-1/test2.bin bs=16M count=16
zfs snapshot zfs/logs/project-1/branch-1@test
zfs clone zfs/logs/project-1/branch-1@test zfs/logs/project-1/branch-3
zfs clone zfs/logs/project-1/branch-1@test zfs/logs/project-1/branch-4
这将创建以下文件系统:
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zfs 1.00G 673G 104K /zfs
zfs/logs 1.00G 673G 144K /zfs/logs
zfs/logs/project-1 256M 673G 112K /zfs/logs/project-1
zfs/logs/project-1/branch-1 256M 673G 256M /zfs/logs/project-1/branch-1
zfs/logs/project-1/branch-2 96K 673G 96K /zfs/logs/project-1/branch-2
zfs/logs/project-1/branch-3 0B 673G 256M /zfs/logs/project-1/branch-3
zfs/logs/project-1/branch-4 0B 673G 256M /zfs/logs/project-1/branch-4
现在我尝试将其复制到另一台机器(在本地机器上进行测试,但稍后我将通过 ssh 进行操作)
# zfs unmount zfs/logs/project-1
# zfs send -R zfs/logs/project-1 | zfs recv zfs/logs/project-3
Error: Unsupported flag with filesystem or bookmark.
cannot receive: failed to read from stream
我的预期:
我期望创建一个新的文件系统,其数据将被重复数据删除(branch-3
并且branch-4
仍然不占用磁盘空间,因为它们是克隆的branch-1
)
# zfs list
NAME USED AVAIL REFER MOUNTPOINT
zfs 1.00G 673G 104K /zfs
zfs/logs 1.00G 673G 144K /zfs/logs
zfs/logs/project-1 256M 673G 112K /zfs/logs/project-1
zfs/logs/project-1/branch-1 256M 673G 256M /zfs/logs/project-1/branch-1
zfs/logs/project-1/branch-2 96K 673G 96K /zfs/logs/project-1/branch-2
zfs/logs/project-1/branch-3 0B 673G 256M /zfs/logs/project-1/branch-3
zfs/logs/project-1/branch-4 0B 673G 256M /zfs/logs/project-1/branch-4
zfs/logs/project-3 256M 673G 112K /zfs/logs/project-3
zfs/logs/project-3/branch-1 256M 673G 256M /zfs/logs/project-3/branch-1
zfs/logs/project-3/branch-2 96K 673G 96K /zfs/logs/project-3/branch-2
zfs/logs/project-3/branch-3 0B 673G 256M /zfs/logs/project-3/branch-3
zfs/logs/project-3/branch-4 0B 673G 256M /zfs/logs/project-3/branch-4
我究竟做错了什么?
答案1
尝试zfs send -R zfs/logs/project-1@snapshot
。
因为您不能递归发送“文件系统”[0],所以您必须发送支持所需功能的对象,如快照[1]。
[0]:zfs list -t filesystem zfs
[1]:zfs list -t snapshot zfs
另请参阅:
zfs list -t all zfs