🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

umount Command

Intermediate Disk & Storage man(1)

Unmount a filesystem

👁 9 views 📅 Updated: Mar 15, 2026
SYNTAX
umount [OPTION]... DIRECTORY|DEVICE

What Does umount Do?

umount detaches a mounted filesystem from the directory tree. It flushes any cached writes to the device before disconnecting, ensuring data integrity.

umount is essential before removing USB drives, external disks, or any removable storage. Removing a device without unmounting can cause data corruption and filesystem damage.

umount may fail if processes are using files on the mounted filesystem. Use fuser or lsof to find the blocking processes.

Options & Flags

OptionDescriptionExample
-l Lazy unmount (detach immediately, cleanup later) sudo umount -l /mnt/stuck
-f Force unmount (for unreachable NFS) sudo umount -f /mnt/nfs
-a Unmount all filesystems sudo umount -a
-R Recursively unmount sudo umount -R /mnt/

Practical Examples

#1 Unmount filesystem

Safely unmounts the USB drive.
$ sudo umount /mnt/usb

#2 Unmount by device

Unmounts using the device name instead of mount point.
$ sudo umount /dev/sdb1

#3 Lazy unmount

Detaches immediately. Cleanup happens when processes stop using it.
$ sudo umount -l /mnt/busy

#4 Force NFS unmount

Forces unmount of an unreachable NFS share.
$ sudo umount -f /mnt/nfs

#5 Find blocking processes

Shows which processes are preventing unmount.
$ fuser -vm /mnt/data

#6 Kill and unmount

Kills all processes using the mount, then unmounts.
$ sudo fuser -km /mnt/data && sudo umount /mnt/data

Tips & Best Practices

Always unmount before removing: Never unplug a USB drive or external disk without unmounting first. Data in write cache will be lost.
Target busy mounts: If 'device is busy': use fuser -vm /mnt to find blocking processes, or lsof /mnt. Kill them, then retry.
Lazy unmount as last resort: umount -l detaches immediately but processes can still access cached data. It is cleaner than force unmount.

Frequently Asked Questions

Why does umount say device is busy?
A process is using files on the mount. Find it with fuser -vm /mnt/point or lsof /mnt/point. cd out if your shell is in the mounted directory.
How do I safely remove a USB drive?
sudo umount /mnt/usb (or /dev/sdX1), then physically remove the device.
What is lazy unmount?
umount -l detaches the filesystem immediately from the directory tree, but cleanup happens later when processes release their file handles.

Master Linux with Professional eBooks

Curated IT eBooks covering Linux, DevOps, Cloud, and more

Browse Books →