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 realpath Command: Resolve Absolute and Canonical Paths

Linux realpath Command: Resolve Absolute and Canonical Paths

Learn how to use the Linux realpath command to resolve relative paths, symbolic links, and redundant path components, with essential options, practical examples, output interpretation, and common troubleshooting tips.

Linux tar Command: Create and Extract Archives

Linux tar Command: Create and Extract Archives

Learn how to create and Extract Archives with the Linux tar command, including practical examples, key options, and important precautions.

Linux lscpu Command: Inspect CPU Architecture and Cores

Linux lscpu Command: Inspect CPU Architecture and Cores

Learn how to inspect CPU Architecture and Cores with the Linux lscpu command, including practical examples, key options, and important precautions.

Linux rm Command: Remove Files and Directories Safely

Linux rm Command: Remove Files and Directories Safely

Learn how to remove files and directory trees with Linux rm, use interactive safeguards, limit recursive deletion, and avoid destructive path mistakes.

Linux Tutorial / Search and Process Text with grep, sort, uniq, cut, and wc

Linux Tutorial / Search and Process Text with grep, sort, uniq, cut, and wc

Practice searching, sorting, grouping, extracting, and counting text with grep, sort, uniq, cut, and wc, including reproducible output and key caveats.

Linux hostnamectl Command: Show and Change the Host Name

Linux hostnamectl Command: Show and Change the Host Name

Learn how to show and Change the Host Name with the Linux hostnamectl command, including practical examples, key options, and important precautions.

Linux sed Command: Search and Replace Text Streams

Linux sed Command: Search and Replace Text Streams

Learn how to search and Replace Text Streams with the Linux sed command, including practical examples, key options, and important precautions.

Linux Tutorial / What Is Linux? Understanding the Kernel, Distributions, and Open Source

Linux Tutorial / What Is Linux? Understanding the Kernel, Distributions, and Open Source

Understand how the Linux kernel differs from a distribution, what user space and open source mean, and how to check your system's kernel and distribution versions.

Linux split Command: Divide Large Files into Smaller Parts

Linux split Command: Divide Large Files into Smaller Parts

Learn how to divide Large Files into Smaller Parts with the Linux split command, including practical examples, key options, and important precautions.

Linux dd Command: Copy and Convert Data by Blocks

Linux dd Command: Copy and Convert Data by Blocks

Learn how to copy and convert files or block devices with Linux dd, choose block sizes and ranges, display progress, verify results, and avoid overwriting the wrong device.