ZFS: Cannot delete snapshot (snapshot is cloned)? Destroy clone first!

Written by - 0 comments

Published on - Listed in Unix Solaris ZFS


On a ZFS backup server, a snapshot couldn't be deleted (destroyed) anymore:

zfs destroy -rR "lowiopool/backups/myserver99@daily-2014-02-01-00:00"
cannot destroy 'lowiopool/backups/myserver99@daily-2014-02-01-00:00': snapshot is cloned
no snapshots destroyed

As the output said, the snapshot was not destroyed and it was still listed in the zfs list output:

zfs list -t snapshot | grep myserver99 | tail
lowiopool/backups/myserver99@daily-2014-01-26-00:00   856M -  1.50T  -
lowiopool/backups/myserver99@daily-2014-01-27-00:00   781M -  1.30T  -
lowiopool/backups/myserver99@daily-2014-01-28-00:00   774M -  1.30T  -
lowiopool/backups/myserver99@daily-2014-01-29-00:00   614M -  1.30T  -
lowiopool/backups/myserver99@daily-2014-02-01-00:00   191M -  1.30T  -

The information "snapshot is cloned" points out that the selected snapshot was previousyl cloned and that the clone is still available.
A snapshot cannot be deleted until all of its clones were destroyed (or promoted to a real file system, but that's another topic).
(Source: http://forums.freenas.org/index.php?threads/replication-problem-delete-a-cloned-snapshot.6625/)

To find the clones, the zfs database (zdb) needs to be consulted:

zdb -d lowiopool |grep "%"
Dataset lowiopool/backups/backups/server23/%daily-2012-12-26-00:00 [ZPL], ID 201724, cr_txg 12724738, 246G, 55 objects
Dataset lowiopool/backups/myserver99/%daily-2014-02-02-00:00 [ZPL], ID 11759, cr_txg 14376982, 1.38T, 3934622 objects

The second entry is our famous clone of the snapshot we tried to delete.

The clone can be deleted like another zfs filesystem or snapshot, using destroy:

zfs destroy lowiopool/backups/myserver99/%daily-2014-02-02-00:00
cannot open 'lowiopool/backups/myserver99/%daily-2014-02-02-00:00': dataset does not exist

Although a warning is shown "dataset does not exist", the clone was deleted:

zdb -d lowiopool |grep "%"
Dataset lowiopool/backups/backups/server23/%daily-2012-12-26-00:00 [ZPL], ID 201724, cr_txg 12724738, 246G, 55 objects

Now the snapshot we have tried to destroy at the begin, can be deleted:

zfs destroy -rR lowiopool/backups/myserver99@daily-2014-02-01-00:00

Verification:

zfs list -t snapshot | grep myserver99 | tail
lowiopool/backups/myserver99@daily-2014-01-25-00:00   473M -  1.30T  -
lowiopool/backups/myserver99@daily-2014-01-26-00:00   856M -  1.50T  -
lowiopool/backups/myserver99@daily-2014-01-27-00:00   781M -  1.30T  -
lowiopool/backups/myserver99@daily-2014-01-28-00:00   774M -  1.30T  -
lowiopool/backups/myserver99@daily-2014-01-29-00:00   628M -  1.30T  -

Yayy!


Add a comment

Show form to leave a comment

Comments (newest first)

No comments yet.

RSS feed

Blog Tags:

  AWS   Android   Ansible   Apache   Apple   Atlassian   BSD   Backup   Bash   Bluecoat   CMS   Chef   Cloud   Coding   Consul   Containers   CouchDB   DB   DNS   Database   Databases   Docker   ELK   Elasticsearch   Filebeat   FreeBSD   Galera   Git   GlusterFS   Grafana   Graphics   HAProxy   HTML   Hacks   Hardware   Icinga   Influx   Internet   Java   KVM   Kibana   Kodi   Kubernetes   LVM   LXC   Linux   Logstash   Mac   Macintosh   Mail   MariaDB   Minio   MongoDB   Monitoring   Multimedia   MySQL   NFS   Nagios   Network   Nginx   OSSEC   OTRS   Office   OpenSearch   PGSQL   PHP   Perl   Personal   PostgreSQL   Postgres   PowerDNS   Proxmox   Proxy   Python   Rancher   Rant   Redis   Roundcube   SSL   Samba   Seafile   Security   Shell   SmartOS   Solaris   Surveillance   Systemd   TLS   Tomcat   Ubuntu   Unix   VMWare   VMware   Varnish   Virtualization   Windows   Wireless   Wordpress   Wyse   ZFS   Zoneminder