117-101 · Question #227
After running the command umount /mnt, the following error message is displayed: umount: /mnt: device is busy. What is a common reason for this message?
The correct answer is B. A user has a file open in the /mnt directory. See the full explanation below for the reasoning.
Question
Options
- AThe kernel has not finished flushing disk writes to themounted device.
- BA user has a file open in the /mnt directory.
- CThe previous rm command has not finished.
- DThe files in /mnt have been scanned and added to the locate database.
- EThe kernel thinks that a process is about to open a file in /mnt for reading.
How the community answered
(32 responses)- A3% (1)
- B72% (23)
- C16% (5)
- D6% (2)
- E3% (1)
Community Discussion
6B is your answer here. When you try to unmount a filesystem and the kernel throws "device is busy," the most common culprit is that a process has an open file handle inside that mount point, or a shell has its working directory set somewhere under /mnt. The kernel cannot safely detach the filesystem while something is actively referencing it, because pulling it out from under a live process could corrupt state or leave the process pointing at nothing. The fix is usually to run lsof +D /mnt or fuser -m /mnt to find what is holding it open, close or kill that process, then retry the umount. The other options don't hold up. Kernel disk flushing happens before the unmount call even gets to the busy check, rm completing or not doesn't pin a mount, locate database scanning doesn't keep file handles open long enough to matter in practice, and option E describing a process "about to" open a file is not how Linux tracks filesystem references, it goes by what is actually open right now.
Saw this exact scenario trip up half my study group on exam day, because everyone panicked and started thinking about kernel buffers or background daemons. Spin up a VM real quick, mount a USB or loop device, cd into it in a second terminal, then try to umount from the first one and watch that "device is busy" error appear, because the shell sitting in that directory counts as an open file handle.
Got this one on my actual exam, immediately flashed back to a stuck bash session in /mnt.
Same, and the part that always trips people up on the exam is remembering that lsof +D /mnt is what you actually need to find the blocking process, not just fuser.
B is right, but do you know the lsof or fuser commands to find *which* process?
Saw this exact scenario on my exam and it tripped me up for a second, but B is definitely it, a process or user has a file open in that directory so the kernel won't let you unmount. Ran into this at my old internship too when a coworker kept getting that error and it turned out he had a terminal window still sitting in /mnt the whole time.