umount: command not found

umount is the opposite of mount: it makes a disk partition unavailable. For instance, if you’ve mounted a CD-ROM disc, you can’t eject it until it’s umounted:

$ umount /mnt/cdrom

Always unmount removable media before ejecting it or you risk damage to its filesystem. To unmount all mounted devices:

# umount -a

Don’t unmount a filesystem that’s in use; in fact, the umount command will refuse to do so for safety reasons.

umount Command Options

Option Description
-a Unmounts all filesystems listed in fstab or Open Directory.
-A Unmounts all currently mounted filesystems, other than the root.
-f Attempts to force the unmount.
-h Unmounts all filesystems currently mounted from the specified server.
-t Restricts the use of the command to filesystems of the specified types presented in a comma-separated list, which may include hfs, ufs, afp, nfs, or others.
-v Enables verbose output.
mount_point The directory on which the filesystem is mounted.

If you encounter the below error while running the umount command:

umount: command not found

you may try installing the below package as per your choice of distribution:

Distribution Command
OS X brew install util-linux
Debian apt-get install mount
Ubuntu apt-get install mount
Alpine apk add util-linux
Arch Linux pacman -S util-linux
Kali Linux apt-get install mount
CentOS yum install util-linux
Fedora dnf install util-linux
Raspbian apt-get install loop-aes-utils

umount Command Examples

1. Unmount a filesystem, by passing the path to the source it is mounted from:

# umount path/to/device_file

2. Unmount a filesystem, by passing the path to the target where it is mounted:

# umount path/to/mounted_directory

3. Unmount all mounted filesystems (except the `proc` filesystem):

# umount -a

4. If you do not want to kill processes holding open files, try lazy unmounts:

# umount -l /mnt/export

Conclusion

umount command unmounts filesystem specified by directory. You may also specify the filesystem by device name. umount announces to the system that the removable file structure previously mounted on the specified directory is to be removed. Any pending I/O for the filesystem is completed, and the file structure is flagged as clean. A busy filesystem cannot be unmounted.

Related Post