Cleaning up snapshots

Now that I’ve copied two filesets from one zpool to another, let’s delete old snapshots.

In this post:

  • FreeBSD 15.0

Freeing up space

I’m still hesitant to delete original data, but I’ll delete the snapshots.

Here’s my list:

[20:25 r730-01 dvl ~] % zfs list -H -o name -r -t snapshot data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15 | grep -v for.data04.0 | less
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-15_00:00:03_daily
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-16_00:00:16_daily
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_00:00:07_daily
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_19:00:02_hourly
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_20:00:02_hourly
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_21:00:09_hourly
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_22:00:09_hourly
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_23:00:11_hourly
...
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/scripts@autosnap_2026-04-19_19:15:13_frequently
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/scripts@autosnap_2026-04-19_19:30:02_frequently
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/scripts@autosnap_2026-04-19_19:45:11_frequently
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/scripts@autosnap_2026-04-19_20:00:01_hourly
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/scripts@autosnap_2026-04-19_20:00:01_frequently

That grep eliminates the snapshot used to send the data to the new zpool. See copied two filesets“>a previous post for more information on that.

From that, I can feed it into zfs destroy:

[20:30 r730-01 dvl ~] % zfs list -H -o name -r -t snapshot data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15 | grep -v for.data04.0 | xargs -n 1 echo zfs destroy | head
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-15_00:00:03_daily
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-16_00:00:16_daily
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_00:00:07_daily
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_19:00:02_hourly
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_20:00:02_hourly
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_21:00:09_hourly
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_22:00:09_hourly
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-17_23:00:11_hourly
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-18_00:00:09_daily
zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@autosnap_2026-04-18_00:00:09_hourly
xargs: echo: terminated with signal 13; aborting
...

OK, let’s try.

[20:30 r730-01 dvl ~] % zfs list -H -o name -r -t snapshot data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15 | grep -v for.data04.0 | xargs -n 1 sudo zfs destroy
[20:31 r730-01 dvl ~] % 

Let’s compare before and after. The following is from a previous post:

[13:45 r730-01 dvl ~] % zfs list -r data02/freshports/dev-ingress01
NAME                                                                USED  AVAIL  REFER  MOUNTPOINT
data02/freshports/dev-ingress01                                     229G  60.6G    88K  none
data02/freshports/dev-ingress01/dvl-src                             197G  60.6G   197G  /jails/dev-ingress01/usr/home/dvl/src
data02/freshports/dev-ingress01/freshports                         22.9G  60.6G  2.09G  /jails/dev-ingress01/var/db/freshports
data02/freshports/dev-ingress01/freshports/cache                   2.30M  60.6G   132K  /jails/dev-ingress01/var/db/freshports/cache
data02/freshports/dev-ingress01/freshports/cache/html              2.07M  60.6G  2.07M  /jails/dev-ingress01/var/db/freshports/cache/html
data02/freshports/dev-ingress01/freshports/cache/spooling           104K  60.6G   104K  /jails/dev-ingress01/var/db/freshports/cache/spooling
data02/freshports/dev-ingress01/freshports/message-queues          20.8G  60.6G  14.4M  /jails/dev-ingress01/var/db/freshports/message-queues
data02/freshports/dev-ingress01/freshports/message-queues/archive  20.8G  60.6G  11.7G  /jails/dev-ingress01/var/db/freshports/message-queues/archive
data02/freshports/dev-ingress01/ingress                            5.39G  60.6G   132K  /jails/dev-ingress01/var/db/ingress
data02/freshports/dev-ingress01/ingress/latest_commits              528K  60.6G   108K  /jails/dev-ingress01/var/db/ingress/latest_commits
data02/freshports/dev-ingress01/ingress/message-queues             1.53M  60.6G   628K  /jails/dev-ingress01/var/db/ingress/message-queues
data02/freshports/dev-ingress01/ingress/repos                      5.39G  60.6G   120K  /jails/dev-ingress01/var/db/ingress/repos
data02/freshports/dev-ingress01/ingress/repos/doc                   549M  60.6G   546M  /jails/dev-ingress01/var/db/ingress/repos/doc
data02/freshports/dev-ingress01/ingress/repos/ports                2.23G  60.6G  2.22G  /jails/dev-ingress01/var/db/ingress/repos/ports
data02/freshports/dev-ingress01/ingress/repos/src                  2.63G  60.6G  2.62G  /jails/dev-ingress01/var/db/ingress/repos/src
data02/freshports/dev-ingress01/jails                              3.05G  60.6G   104K  /jails/dev-ingress01/jails
data02/freshports/dev-ingress01/jails/freshports                   3.05G  60.6G   405M  /jails/dev-ingress01/jails/freshports
data02/freshports/dev-ingress01/jails/freshports/ports             2.65G  60.6G  2.65G  /jails/dev-ingress01/jails/freshports/usr/ports
data02/freshports/dev-ingress01/modules                            4.38M  60.6G  4.38M  /jails/dev-ingress01/usr/local/lib/perl5/site_perl/FreshPorts
data02/freshports/dev-ingress01/scripts                            3.30M  60.6G  3.30M  /jails/dev-ingress01/usr/local/libexec/freshports

The following is after the zfs destroy completed.

[20:36 r730-01 dvl ~] % zfs list -r data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15            
NAME                                                                                           USED  AVAIL  REFER  MOUNTPOINT
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15                                     220G  76.8G    88K  none
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src                             197G  76.8G   197G  /jails/dev-ingress01/usr/home/dvl/src
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/freshports                         13.8G  76.8G  2.09G  /jails/dev-ingress01/var/db/freshports
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/freshports/cache                   2.63M  76.8G   132K  /jails/dev-ingress01/var/db/freshports/cache
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/freshports/cache/html              2.27M  76.8G   220K  /jails/dev-ingress01/var/db/freshports/cache/html
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/freshports/cache/spooling           176K  76.8G   104K  /jails/dev-ingress01/var/db/freshports/cache/spooling
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/freshports/message-queues          11.7G  76.8G  14.4M  /jails/dev-ingress01/var/db/freshports/message-queues
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/freshports/message-queues/archive  11.7G  76.8G  11.7G  /jails/dev-ingress01/var/db/freshports/message-queues/archive
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress                            5.37G  76.8G   124K  /jails/dev-ingress01/var/db/ingress
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress/latest_commits              168K  76.8G   108K  /jails/dev-ingress01/var/db/ingress/latest_commits
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress/message-queues              628K  76.8G   628K  /jails/dev-ingress01/var/db/ingress/message-queues
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress/repos                      5.37G  76.8G    88K  /jails/dev-ingress01/var/db/ingress/repos
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress/repos/doc                   546M  76.8G   546M  /jails/dev-ingress01/var/db/ingress/repos/doc
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress/repos/ports                2.22G  76.8G  2.22G  /jails/dev-ingress01/var/db/ingress/repos/ports
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/ingress/repos/src                  2.62G  76.8G  2.62G  /jails/dev-ingress01/var/db/ingress/repos/src
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/jails                              3.05G  76.8G    96K  /jails/dev-ingress01/jails
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/jails/freshports                   3.05G  76.8G   405M  /jails/dev-ingress01/jails/freshports
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/jails/freshports/ports             2.65G  76.8G  2.65G  /jails/dev-ingress01/jails/freshports/usr/ports
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/modules                            4.38M  76.8G  4.38M  /jails/dev-ingress01/usr/local/lib/perl5/site_perl/FreshPorts
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/scripts                            3.30M  76.8G  3.30M  /jails/dev-ingress01/usr/local/libexec/freshports

Not enough gone. So I decided to clean this one up:

[20:36 r730-01 dvl ~] % sudo zfs destroy data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src
cannot destroy 'data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src': filesystem has children
use '-r' to destroy the following datasets:
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src@for.data04.0
[20:38 r730-01 dvl ~] % sudo zfs destroy -r data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15/dvl-src
[20:38 r730-01 dvl ~] % 
[20:38 r730-01 dvl ~] % zfs list data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15             
NAME                                                         USED  AVAIL  REFER  MOUNTPOINT
data02/freshports/dev-ingress01.DELETE.ME.after.2026.05.15  22.2G   274G    88K  none

That’s better.

So is this:

[20:40 r730-01 dvl ~] % zpool list data02
NAME     SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
data02   928G   605G   323G        -         -    25%    65%  1.00x    ONLINE  -

Next, I’ll migrate other datasets over, one logical-group at a time. By that, I mean a top-level dataset, like I did for data02/freshports/dev-ingress01.

Cheers.

Website Pin Facebook Twitter Myspace Friendfeed Technorati del.icio.us Digg Google StumbleUpon Premium Responsive

Leave a Comment

Scroll to Top