8

Is it possible to split a zfs clone to allow the original snapshot to be destroyed?

# zfs create zpool1/test1
# zfs snapshot zpool1/test1@snap1
# zfs clone zpool1/test1@snap1 zpool1/test1clone
# zfs destroy zpool1/test1@snap1
cannot destroy 'zpool1/test1@snap1': snapshot has dependent clones
use '-R' to destroy the following datasets:
zpool1/test1clone
# 

At this point, it would like to 'actualize' the zpool1/test1clone file system, essentially as if I had performed a zfs send zpool1/test1@snap1 | zfs receive zpool1/test1clone.

ewwhite
  • 198,150

2 Answers2

7

You would need to promote the ZFS clone to a filesystem in order to be able to destroy the original snapshot/filesystem.

zfs promote zpool1/test1clone

Please see: http://download.oracle.com/docs/cd/E19253-01/819-5461/gcvfl/index.html

zfs promote filesystem
     Promotes a clone file system to no longer  be  dependent
     on its "origin" snapshot. This makes it possible to des-
     troy the file system that the clone  was  created  from.
     The   clone   parent-child  dependency  relationship  is
     reversed, so that the "origin"  file  system  becomes  a
     clone of the specified file system.
ewwhite
  • 198,150
  • 1
    promote doesn't really do what I want, as all it seems to do really seems to do is move the snapshot from the original file system onto the cloned filesystem, and then setups a dependency the other way around, meaning the original filesystem now has a dependency. I want to remove any dependencies between the file systems – Matthew Watson May 03 '11 at 11:37
  • Rename the promoted filesystem. – ewwhite May 03 '11 at 11:53
  • 1
    Matthew is right. zfs list -t all -o name,origin,clones -r zpool1 shows the clone hierarchy. – baloan Jan 06 '23 at 19:09
7

If you don't want there to be any ties between the child and parent filesystems, you will have to do a zfs send/receive.

ttyS0
  • 477