ZFS can't destroy snapshot, dataset busy

dweimer dweimer at dweimer.net
Thu Apr 10 14:24:18 UTC 2014

I have a server running on ZFS, with multiple jails.  I use bacula to 
back it up, and have written a python script that finds all my ZFS 
datasets (except those I have listed to ignore) and creates snapshots, 
then mounts those snapshots to a temporary file structure, using mount 
-t nullfs /zfs-mountpoint/.zfs/snapshot/snapshotname /mnt/backup/...  I 
then backup the data from the snapshots, and kick off a second script 
that dismounts the nullfs mounted snapshots and destroys them.  I have 
the same script running on multiple servers without jails and everything 
works great.

However on this server that is running 4 jails, (base OS is FreeBSD 
10-RELEASE-p1, as of last night) the root file system in the jails is 
frequently holding the snapshots as busy so they fail to destroy, which 
then breaks the backups for that jail until resolved.

The only resolution I have found do an unmount -f 
/zfs-mountpoint/.zfs/snapshot/snapshotname and then I am able to destroy 
the snapshot.  The nullfs mounts are gone, but I haven't been able to 
find what process is holding onto the snapshot file system.

Before I edit my script to add this step in prior to destroying the 
snapshots, does anybody have any ideas on how to find out whats keeping 
these file systems busy?

I have already tried restarting the jail using jail -r and jail -c it 
doesn't help, its something in the base Operating System

    Dean E. Weimer

More information about the freebsd-questions mailing list