Managing ZFS File Systems in Oracle® Solaris 11.2

Exit Print View

Updated: December 2014
 
 

Destroying a ZFS File System

To destroy a ZFS file system, use the zfs destroy command. The destroyed file system is automatically unmounted and unshared. For more information about automatically managed mounts or automatically managed shares, see Automatic Mount Points.

In the following example, the tank/home/mark file system is destroyed:

# zfs destroy tank/home/mark

Caution

Caution  - No confirmation prompt appears with the destroy subcommand. Use it with extreme caution.


If the file system to be destroyed is busy and cannot be unmounted, the zfs destroy command fails. To destroy an active file system, use the –f option. Use this option with caution as it can unmount, unshare, and destroy active file systems, causing unexpected application behavior.

# zfs destroy tank/home/matt
cannot unmount 'tank/home/matt': Device busy

# zfs destroy -f tank/home/matt

The zfs destroy command also fails if a file system has descendents. To recursively destroy a file system and all its descendents, use the –r option. Note that a recursive destroy also destroys snapshots, so use this option with caution.

# zfs destroy tank/ws
cannot destroy 'tank/ws': filesystem has children
use '-r' to destroy the following datasets:
tank/ws/jeff
tank/ws/bill
tank/ws/mark
# zfs destroy -r tank/ws

If the file system to be destroyed has indirect dependents, even the recursive destroy command fails. To force the destruction of all dependents, including cloned file systems outside the target hierarchy, the –R option must be used. Use extreme caution with this option.

# zfs destroy -r tank/home/eric
cannot destroy 'tank/home/eric': filesystem has dependent clones
use '-R' to destroy the following datasets:
tank//home/eric-clone
# zfs destroy -R tank/home/eric

Caution

Caution  - No confirmation prompt appears with the –f, –r, or –R options to the zfs destroy command, so use these options carefully.


For more information about snapshots and clones, see Chapter 6, Working With Oracle Solaris ZFS Snapshots and Clones.