ZFS destroy error “cannot determine dependent datasets: recursive dependency”
Problem
In the following case, the origin of clone (datapool/ds1) is a snapshot of its descendant (datapool/ds1/ds2).
# zfs get -r origin datapool NAME PROPERTY VALUE SOURCE datapool/ds1 origin datapool/ds1/ds2@snap - datapool/ds1/ds2 origin - - datapool/ds1/ds2@snap origin - -
To destroy datapool/ds1/ds2, its snapshot datapool/ds1/ds2@snap needs to be destroyed.
To destroy datapool/ds1/ds2@snap, its dependent clone datapool/ds1 needs to be destroyed.
To destory datapool/ds1, its child filesystem datapool/ds1/ds2 needs to be destroyed.
To destroy datapool/ds1/ds2@snap, its dependent clone datapool/ds1 needs to be destroyed.
To destory datapool/ds1, its child filesystem datapool/ds1/ds2 needs to be destroyed.
Therefore, due to the recursive dependency, none of dataset/clone/snapshot under datapool/ds1 can be destroyed.
# zfs destroy -R datapool/ds1 cannot determine dependent datasets: recursive dependency at 'datapool/ds1'
Solution
This recursive dependency occurs when a clone which is a child of the origin’s parent was promoted like this.
# zfs create mpool/ds1 # zfs snap mpool/ds1@snap # zfs clone mpool/ds1@snap mpool/ds1/ds2 # zfs promote mpool/ds1/ds2
Either of the following will resolve the recursive dependency.
1. Promote the clone
# zfs promote mpool/ds1
# zfs get -r origin mpool NAME PROPERTY VALUE SOURCE mpool/ds1 origin - - mpool/ds1@snap origin - - mpool/ds1/ds2 origin mpool/ds1@snap -
2. Rename the child dataset to a name which is not a child of the clone
# zfs rename mpool/ds1/ds2 mpool/tmp
# zfs get -r origin mpool NAME PROPERTY VALUE SOURCE mpool/ds1 origin mpool/tmp@snap - mpool/tmp origin - - mpool/tmp@snap origin - -
No comments:
Post a Comment