umount
Overview
umount detaches a filesystem from the directory tree. Pair with mount, lsblk, and findmnt for storage workflows.
Syntax
umount [options] <mountpoint|device>
umount -aCommon Options
| Option | Description |
|---|---|
-l |
Lazy unmount (detach when busy) |
-f |
Force (mainly for NFS) |
-r |
Remount read-only if unmount fails |
-v |
Verbose |
Key Use Cases
- Detach USB/data disks cleanly
- Unmount before fsck or repartition
- Clear busy NFS mounts
- Release mounts in scripts/chroots
Safety
Never unmount the root filesystem on a live system. Ensure no critical writes are in flight; prefer clean process shutdown over -f on local disks.
Examples with Explanations
Unmount by mountpoint
sudo umount /mnt/dataPreferred: use the path you mounted on.
Unmount by device
sudo umount /dev/sdb1Equivalent when you know the block device.
Busy mount diagnosis
findmnt /mnt/data
sudo lsof +f -- /mnt/data
sudo fuser -vm /mnt/dataSee who still uses the mount before retrying.
Lazy unmount
sudo umount -l /mnt/dataDetaches immediately; cleanup when references drop — use carefully.