ZFS删除具有相关性和克隆的快照

以下是我的ZFS卷和快照列表,以及每个ZFS卷的来源和克隆。

我想删除所有的快照,但保留所有的文件系统。 我怎样才能做到这一点?

我已经试过zfs promote升级,然后尝试删除文件系统的许多不同组合的每个文件系统。 这转移了快照“生活”的地方; 例如, zfs promote tank/containers/sixtank/containers/three@F zfs promote tank/containers/six移动快照tank/containers/three@F提升到tank/containers/six@F 文件系统中的实时数据没有被修改(这是我想要的!),但我仍然不能删除快照(这不是我想要的)。

一个典型的zfs destroy尝试告诉我它有依赖的克隆,其中一些(快照)我想销毁,但其他的(文件系统)我不想销毁。

例如。

 # zfs destroy tank/containers/six@A cannot destroy 'tank/containers/six@A': snapshot has dependent clones use '-R' to destroy the following datasets: tank/containers/five tank/containers/two@B tank/containers/two 

在上面的例子中,我不想摧毁tank/containers/fivetank/containers/two ,但是如果我们zfs promote五个和两个,我仍然不能销毁任何快照。 有解决scheme吗?

 # zfs list -t all -o name,origin,clones NAME ORIGIN CLONES tank - - tank/containers - - tank/containers/five tank/containers/two@B - tank/containers/four tank/containers/six@C - tank/containers/one - - tank/containers/one@E - tank/containers/three tank/containers/two tank/containers/six@A - tank/containers/two@B - tank/containers/five tank/containers/six tank/containers/three@F - tank/containers/six@A - tank/containers/two tank/containers/six@C - tank/containers/four tank/containers/three tank/containers/one@E - tank/containers/three@F - tank/containers/six 

AFAIK你将不得不把这些数据集复制到新的,独立的数据集。 促销只是切换哪个数据集是“父”与“小孩”,如果你想保持两者都不会破坏任何依赖关系。

例如:root @ box:〜#zfs快照tank / containers / six @ 1; zfs send tank / containers / six @ 1 | pv | zfs接收坦克/容器/ newsix; zfs销毁-Rjar/容器/六; zfs摧毁坦克/容器/三@ F; zfs重命名坦克/容器/ newsix坦克/容器/六

我真的不build议尝试把所有的命令串在一起,请注意,花点时间,确定你在做什么。 特别是与实际删除。

这种复制是以块为单位的,所以如果有任何重要的数据会花费一段时间。 pv部分是严格的可选的,但是在你等待的时候会给你一个进度条来看看。

也可以考虑使用syncoid来自动化复制任务,现在和将来。