Skip to content

umount Command Cheat Sheet

umount detaches the file system(s) from the file hierarchy.


Synopsis

umount [options] <source> | <directory>

Basic Usage

Unmount by Mount Point

sudo umount /mnt/backup

Unmount by Device

sudo umount /dev/sdb1

Solving "Device is Busy"

If you get: target is busy.

Lazy Unmount (-l)

Detaches the filesystem from the hierarchy immediately, and cleans up all references to the filesystem as soon as it is not busy anymore.

sudo umount -l /mnt/backup
Best for stuck NFS mounts.

Force Unmount (-f)

In case of unreachable NFS system.

sudo umount -f /mnt/backup
(Dangerous for data integrity on local drives).

Find Process Holding It

Use lsof or fuser to see who is using the drive.

lsof +D /mnt/backup
# OR
fuser -m /mnt/backup

Kill them automatically (Dangerous):

fuser -km /mnt/backup


Unmount All (-a)

Unmount all filesystems described in /etc/mtab.

sudo umount -a

Recursive Unmount (-R)

Recursively unmount a target and all its sub-mounts (e.g., if you mounted --bind things inside).

sudo umount -R /mnt/chroot

Notes

  • Data Loss: Always run sync before unmounting to ensure buffers are flushed, although umount attempts to sync automatically.