umount
Files and directories
Usage
sudo umount [mountpoint]Detaches a mounted filesystem; the name has no n in it, and it refuses with device is busy while any process still has a file or its working directory inside.
Common flags
| Flag | Meaning |
|---|---|
| -l | Linux: detach lazily, as soon as nothing is using it |
| -f | Force, which is what an unreachable network share needs |
| -R | Linux: unmount everything below a path |
| -a | Unmount everything listed in /etc/fstab |
Examples
sudo umount /mntDetaches the filesystem.
sudo umount -l /mntDetaches as soon as the last user is done (Linux).
lsof +D /mntFinds what is holding it when it says target is busy.
Moving, deleting and finding. Some of these do not ask twice, which is why -i becomes a habit.
How to read this
- Square brackets [ ] mark a part you may leave out.
- An ellipsis … means you can list more than one.
- Flags are case-sensitive — in some commands -r and -R do different things.
Questions
Q. What does umount do?
Detaches a mounted filesystem; the name has no n in it, and it refuses with device is busy while any process still has a file or its working directory inside.
Q. How do I type it?
sudo umount [mountpoint] — square brackets mark the parts you can leave out.
Q. How many flags are worth knowing?
4 are listed here; the full set is in man umount. This command sits under Files and directories.
Related commands
man page: man umount