我保留 zfs 快照备份,并且我的虚拟机在直接位置zfs/snapshotbackps
运行zfs
我正在尝试创建一个脚本来提取最新的快照并恢复它。
我尝试过以下方法
machine=582
zfs list -o name -s creation -t snapshot | grep "zfs/snapshotbackps/vm-${machine}-" |tail -n1 | xargs zfs send | "zfs receive zfs/vm-${machine}-disk-0"
哪个返回
-bash: zfs receive zfs/vm-582-disk-0: No such file or directory
xargs: zfs: terminated by signal 13
出了什么问题,数据就在那里
zfs list -o name -s creation -t snapshot | grep "zfs/snapshotbackps/vm-${machine}-" |tail -n1
zfs/snapshotbackps/vm-582-disk-0@ZAP_HOME1_2023-05-19T10:26:19p0100--1w
答案1
你的引用有缺陷。尝试类似的方法:
machine="582"
snap="$(zfs list -o name -s creation -t snapshot |
grep "zfs/snapshotbackps/vm-${machine}-" |
tail -n1)"
zfs send "$snap" | zfs receive "zfs/vm-${machine}-disk-0"
如果删除zfs receive
.您收到的错误消息与您键入以下内容时收到的消息相同:
$ "echo foo"
bash: echo foo: command not found
zfs rollback
您也可以考虑在原始文件系统上进行操作zfs/vm-582-disk-0
。应该会快一点。