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 default FreeBSD system utility lsof can be used to list processes, that has open files.

# lsof /mnt/foobar
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)

Some implemenations support more of the initial characters of the command name. Version 4.99.3 for FreeBSD should support up to 19.

# lsof +c 19 /mnt/foobar

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*'

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 proces with open files on FreeBSD.

Kill the proces 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.

Unmount device.

# umount /mnt/foobar

More about this.

LSOF on FreeBSD Manual Pages.