Re: More than 40 minutes to delete an obj tree?

From: Rodney W. Grimes <freebsd-rwg_at_gndrsh.dnsmgr.net>
Date: Sat, 17 Jan 2026 20:13:39 UTC
[ Charset UTF-8 unsupported, converting... ]
> Toomas Soome <tsoome@me.com> wrote:
> 
> >> Is it normal that it takes so much real time to cleanup a universe build
> >> these days or is that a ZFS tuning issue?  It feels a bit excessive.
> > 
> > For workaround, zfs destroy should be a bit faster than rm -rf (unless there is deduplication involved?.).
> 
> I don't consider this a workaround because it is much faster ;-)
> 
> In my case a clean /usr/obj takes seconds by:
> 	zfs destroy -r zp0/_obj
> 	zfs create -o mountpoint=/usr/obj zp0/_obj
> 
> YMMV,
> Michael

zfs create -o mountpoint=/usr/obj ${POOL}/usr/obj
zfs snapshot ${POOL}/usr/obj@EMPTY
# make what ever you need and do what ever you want with it
zfs rollback ${POOL}/usr/obj@EMPTY

This eliminates the window between destroy and create.
You may need to add a -r to the rollback if you have some autosnap
shots running that create dependent snapshots.


-- 
Rod Grimes                                                 rgrimes@freebsd.org