My Oracle Support Banner

"zfs destroy tank/dataset@snap_for_clone" results in "cannot destroy 'tank/dataset@snap_for_clone': dataset already exists" (Doc ID 2146908.1)

Last updated on SEPTEMBER 10, 2019

Applies to:

Solaris Operating System - Version 10 1/13 U11 to 11.3 [Release 10.0 to 11.0]
Information in this document applies to any platform.

Symptoms

We have a dataset as

 

# zfs list
NAME    USED  AVAIL  REFER  MOUNTPOINT
tank  104K  66.9G    31K  /tank

 

User wants to move the data from the root (tank) to a newly created child dataset as "child".
And follows the zfs man pages as

  Clones
     A clone is a writable volume or file  system  whose  initial
     contents are the same as another dataset. As with snapshots,
     creating a clone is nearly instantaneous, and initially con-
     sumes no additional space.

     Clones can only be created from a snapshot. When a  snapshot
     is  cloned,  it  creates  an implicit dependency between the
     parent and child. Even though the clone is created somewhere
     else  in the dataset hierarchy, the original snapshot cannot
     be destroyed as long as a clone exists. The origin  property
     exposes  this  dependency, and the destroy command lists any
     such dependencies, if they exist.

     The  clone  parent-child  dependency  relationship  can   be
     reversed  by  using  the promote subcommand. This causes the
     "origin" file system to become a clone of the specified file
     system,  which  makes it possible to destroy the file system
     that the clone was created from.

With that in mind, a snapshot is taken

# zfs snapshot tank@snap_for_clone

Now following datasets exist

# zfs lilst
NAME                  USED  AVAIL  REFER  MOUNTPOINT
tank                  128K  66.9G    31K  /tank
tank@snap_for_clone      0      -    31K  -

Now clone the snapshot

# zfs clone tank@snap_for_clone   tank/child
# zfs list

NAME                  USED  AVAIL  REFER  MOUNTPOINT
tank                  150K  66.9G    32K  /tank
tank@snap_for_clone    20K      -    31K  -
tank/child              1K  66.9G    31K  /tank/child

Check the origin

# zfs get origin
NAME                 PROPERTY  VALUE                SOURCE
tank                 origin    -                    -
tank@snap_for_clone  origin    -                    -
tank/child           origin    tank@snap_for_clone  -

Note that the origin of tank/child is the snapshot

 

Promote the clone

# zfs promote tank/child

and look at the origin

# zfs get origin
NAME                       PROPERTY  VALUE                      SOURCE
tank                       origin    tank/child@snap_for_clone  -
tank/child                 origin    -                          -
tank/child@snap_for_clone  origin    -                          -

Note that origin of tank (root dataset) is the snapshot

So, now the snapshot can not be destroyed

# zfs destroy tank/child@snap_for_clone
cannot destroy 'tank/child@snap_for_clone': dataset already exists

 

 

 

 

 

 

 

 

 

Cause

To view full details, sign in with your My Oracle Support account.

Don't have a My Oracle Support account? Click to get started!


In this Document
Symptoms
Cause
Solution


My Oracle Support provides customers with access to over a million knowledge articles and a vibrant support community of peers and Oracle experts.