Linux distributions like Ubuntu, Debian, CentOS, RHEL, and others use disks by mounting them to the file system. We have already examined
mount command in the following tutorial. In this tutorial we will learn how to umount the disk in a Linux system.
Before unmount we should be sure that all changes are written to the file system and disk. So we need to close open files that reside in the file system we want to unmount.
umount command help information can be listed with
--help like below.
Umount Specified Partition
We will start by unmounting specified partition. We can unmount just providing the partition path. In this example, we will unmount
/dev/hda1. We need root privileges in order to complete this job.
$ sudo umount /dev/hda1
Unmount All Partitions
If we need to unmount all partitions of file systems currently mounted to the Linux system. We will use
-a option which means all .
$ sudo umount -a
Force To Unmount
In some cases write operations can be resume for a long time and we need to unmount the file system. So we can force
umount command with
-f option like below.
$ sudo umount -f /dev/hda1
umount failed we can find detailed information about the reason. We can use
-v option which will list detailed information while trying to unmount.
$ sudo umount -v /dev/hda1