Sometimes, even though you have closed all applications, you can experience, that FreeBSD and other operating systems can not unmount an external USB disk drive or other mounted device, because of the error message Device busy.
# umount /mnt/foobar umount: unmount of /mnt/foobar failed: Device busy
Find program, that is using file on FreeBSD.
Find out, what what program or proces is actually associated with use of the external USB disk drive or file in general. For this, the system utility lsof can be used to list processes, that has open files.
# lsof /mnt/foobar COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME gvfsd-tra 1337 foo 16r VDIR 4294967295,3976269473 262144 1 /mnt/foobar (/dev/da0s1) gvfsd-tra 1337 foo 17r VDIR 4294967295,3976269473 262144 1 /mnt/foobar (/dev/da0s1)
What is gvfsd?
The proces gvfsd-tra with open files and busy device is often seen in list of processes on FreBSD and other systems with GNOME.
Using the system utility find to search for the command from that output, the proces, that has open files, in this example, is gvfsd-trash. The idiot, who wrote this, did not bother to make a manual, and, search engines has nothing, but errors and bugs on it.
# find / -type f -name '*gvfsd-tra*' /usr/local/libexec/gvfsd-trash
However, gvfs is very likely short for GNOME virtual file system, so it is safe to assume, that it is a GNOME component, that is associated with running a trash bin instead of actually deleting files.
# pkg search gvfs gvfs-1.50.2_1 GNOME virtual file system
Kill program or proces with open file on FreeBSD.
Kill the process by its PID or by its name, that was listed by the lsof command.
# kill 1337 # pkill gvfsd-trash
The gvfsd-trash proces should no longer have open files and the external USB hard drive can be unmounted.
# umount /mnt/foobar