Reversing a ZFS mistake

Dan Nelson dnelson at
Mon Dec 1 17:48:52 PST 2008

In the last episode (Dec 02), Reinis Ivanovs said:
> It seems I've made a mistake using ZFS, and now my /usr/local/ is
> empty. I wanted to create a snapshot of a directory inside of it, so
> I ran "zfs create tank/usr/local" and "zfs create tank/usr/local/www"
> as I had seen in the guides I'd been using. That worked, but the
> filesystems created were empty. As I found out later, doing what I
> did on Solaris would have created the filesystems but not mounted
> them, but on FreeBSD they were mounted automatically, and the
> previous contents hidden. The question now is, how do I get my files
> back? The system is crippled without /usr/local/ and I can't unmount
> or destroy it, because it says that the device is busy. Any help
> would be appreciated.

Solaris should have automatically mounted them too, unless you had "zfs
set" canmount=noauto or mountpoint=legacy on an upper filesystem.  If
you intend to copy/move the existing contents into these new
filesystems, you can just umount them and manually mount them somewhere
else ( mount -t zfs tank/usr/local /tmp/local ) while you do the copy,
then remount them in their final locations.  umount -f should let you
force-dismount them even if processes have open filehandles on them. 
If it doesn't, run "fstat -f /usr/local" and kill any processes that
show up, then try umounting again.

	Dan Nelson
	dnelson at

More information about the freebsd-questions mailing list