Front | Info | Lists | Newsfeeds | Study Guide | What is BSD?
Advertisement: The OpenBSD PF Packet Filter Book: PF for NetBSD, FreeBSD, DragonFly and OpenBSD

BSD Links
·New Links
·User Groups

This is the BSDA Study Guide Book written via a wiki collaboration. This is a work in progress. You may contribute to or discuss this specific page at

Deal with busy devices


Understand what can cause a process to hang, how to detect related processes, and how to fix the situation.


Occasionally there are situations where a userland process can completely hang due to kernel being stuck in the I/O path. The most common way this could happen is by using mount(8) and umount(8) tools on nonreliable (TODO: unreliable??) removable media (like USB and CD drives) and network devices (like smbfs). In the general case, there's no reliable way to fix this situation except a reboot, but sometimes the system utilities can kill the stuck process and allow most of the system to continue running.

The first step is to identify the process that's stuck. In most cases, this is obvious since it's the process the user has just started or is currently interfacing with. But even in this case, it's useful to find out more information about the process for future reference and to help debug the problem. A good starting point is the ps(1) utility. The command:

ps axul

TODO: maybe use different switches or use -o because u + l duplicates some fields and anyways the output is too long to fit on console or in book :)

will display a table containing (a)ll processes, even those without an attached terminal (x), together with (u)ser information and (l)ock channels. The last information is the same as the "STATE" field shown by the top(8) utility.

TODO: show example of WCHAN, STAT or other fields that indicate hung process

TODO: maybe cross-reference with View and configure system hardware?

fstat: identify active files

umount: unmount file systems

lsof: list open files


Practice Exercises

More information

ps(1), fstat(1), kill(1), umount(8) and the third-party lsof utility

Front | Information | Lists | Newsfeeds