Linux umount Command: Unmount a Filesystem Safely

umount detaches a mounted file system from the directory tree. It is used to unmount USB storage devices or temporary mounts, and the command name is unmount, not umount.

What is the umount command?

Before unmounting, you must ensure that all writes to the file system are complete and that no processes are using the files. If it is in use, you usually get a target is busy error. You can specify either the mount point or the device, but if connected in multiple places, the mount point is clearer.

Basic syntax

umount [option] mount_point|device

The installed implementation and options may vary depending on the distribution. Check the current system's description with man umount.

Examples

Check the target for unmounting

Check the device and the actual mount point.

findmnt /mnt/data

Normal unmounting

Move the current shell's working directory out of the target and then unmount.

sudo umount /mnt/data

Check unmount results

Check whether the mount at the specified path has disappeared.

findmnt /mnt/data

Check Whether Unmounting Was Successful

umount detaches a filesystem from the directory tree. If there are processes using the target path, it may fail with an error like target is busy.

findmnt /mnt/data
sudo umount /mnt/data
findmnt /mnt/data

If the unmount is successful, umount usually does not print anything, and the last findmnt will not show the corresponding mount entry. The mount point directory may remain.

Forcibly detaching files that are in use can risk data loss, so first check the working directory and open files. lsof or fuser can be helpful. Before disconnecting external storage devices, make sure any write operations are completed.

Main Options and Format

Options/Format Description
-R Recursively unmount child mounts under the specified mount point.
-l Lazy unmount. It may not be completely cleaned up until it is no longer in use.
-f Attempt forced unmount on certain network file systems.
-t format Only targets the specified file system type.

Precautions when using

If umount gives a busy error, check the current shell location and files/processes in use. -l is not a safe default option that immediately resolves the problem, and -f also carries the risk of data loss. Make sure any important writes are completed before unmounting and physically remove the device.

Frequently Asked Questions

Why does umount show 'target is busy'?

This is because the process's current directory or open files are using the file system. Check the users and try again after they have finished their tasks.

Official Documentation

You can check the exact behavior of the options and implementation-specific differences in the official documentation related to umount.

More in This Category
Linux dnf Command: Manage RPM Distribution Packages

Linux dnf Command: Manage RPM Distribution Packages

Learn how to manage RPM Distribution Packages with the Linux dnf command, including practical examples, key options, and important precautions.

Linux top Command: Monitor Processes in Real Time

Linux top Command: Monitor Processes in Real Time

Learn how to monitor Processes in Real Time with the Linux top command, including practical examples, key options, and important precautions.

Linux command Command: Run Commands While Bypassing Aliases and Functions

Linux command Command: Run Commands While Bypassing Aliases and Functions

Learn how to use the Linux command command to check command availability and bypass shell aliases or functions, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux unzip Command: List and Extract ZIP Archives

Linux unzip Command: List and Extract ZIP Archives

Learn how to list and Extract ZIP Archives with the Linux unzip command, including practical examples, key options, and important precautions.

Linux whoami Command: Show the Effective User Name

Linux whoami Command: Show the Effective User Name

Learn how to show the Effective User Name with the Linux whoami command, including practical examples, key options, and important precautions.

Linux chown Command: Change File Owner and Group

Linux chown Command: Change File Owner and Group

Learn how to change File Owner and Group with the Linux chown command, including practical examples, key options, and important precautions.

Linux chgrp Command: Change a File's Group

Linux chgrp Command: Change a File's Group

Learn how to change a File's Group with the Linux chgrp command, including practical examples, key options, and important precautions.

Linux bunzip2 Command: Decompress bzip2 Files

Linux bunzip2 Command: Decompress bzip2 Files

Learn how to decompress bzip2 Files with the Linux bunzip2 command, including practical examples, key options, and important precautions.

Linux Tutorial / Understand systemd Services, Boot, and Logs

Linux Tutorial / Understand systemd Services, Boot, and Logs

Understand Linux boot stages and systemd units, distinguish active services from boot enablement, and inspect current-boot logs with systemctl and journalctl.

Linux machine-id: How to Check and Reset It for Cloned Systems

Linux machine-id: How to Check and Reset It for Cloned Systems

Learn what the Linux machine-id identifies, how to check it, and how to prepare cloned system images for unique IDs. Understand the difference between an empty file and first-boot initialization.