System and processes

The umount command

Unmounts a disk or mounted folder so it can be removed.

Syntax

umount DISPOSITIVO|CARPETATry it in the terminal →

Most useful options

-l, --lazyLazy unmount: detaches the file system now and cleans it up once it is no longer busy
-f, --forceForces the unmount. It is mainly meant for an unreachable NFS share
-R, --recursiveUnmounts each folder given and also the file systems mounted on top of it
-a, --allUnmounts everything listed in /proc/self/mountinfo, except proc, sysfs, devpts and other system file systems
-r, --read-onlyIf the unmount fails, tries to remount the file system read-only
-v, --verboseVerbose mode: shows more detail about what it does

Copy-ready examples

$ sudo mount /dev/sdb1 /mnt && sudo umount /mntmounts and unmounts in one step, to check that it works.
$ sudo umount /mntunmounts by folder. Giving the device also works, but the manual considers it obsolete.
$ sudo umount -l /mntlazy unmount, when the folder is busy and you cannot close what uses it.
$ sudo umount -a -t vfatunmounts all mounted vfat file systems. It is destructive for anything you have open on them: check with mount what is mounted first.

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • If you are inside the mounted folder, or files are open from it, the unmount fails with 'target is busy'.
  • Do not use -l out of habit: a lazy unmount keeps references alive until they are released, and the manual reserves it mainly for network shares that went down.
  • Without administrator rights, umount only works if fstab has the user option for that mount point.

Differences from similar commands

  • mount: does the opposite: attaches a device to a folder.
  • lsblk: shows disks and partitions and where they are mounted. umount is what unmounts them.

Related commands

FAQ

Why does it say it is busy?

Something is using the folder: a terminal inside it, an open file or a swap file located there. Close what uses it and try again.

Can I unmount without sudo?

Only if fstab has the user option on that line. Otherwise you need root.

What exactly does -l do?

It detaches the file system immediately and cleans up the references once it is no longer busy. The manual recommends it to avoid hangs at shutdown with a downed network resource.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course