FreeKB - Linux Commands umount (unmount a partition or share)
Linux Commands - umount (unmount a partition or share)

The umount command can be used to temporarily unmount a directory from a partition. For example, let's say the df -Th command shows that the /var directory is mounted onto the /dev/sda3 partition.

Filesystem                   Type      Size  Used Avail Use% Mounted on
/dev/sda3                    ext4      922M   90M  770M  11% /var

 

Likewise, the mount command will show that the /var directory is mounted onto the /dev/sda3 partition.

/dev/sda3 on /var type ext4 (rw,relatime,seclabel)

 

While mounted, you can view the contents of the /var directory.

~]# ll /var
drwxr-xr-x.  9 root root  4096 May 14 15:54 log
drwxr-xr-x.  9 root root  4096 May 14 15:54 logs
drwx------.  2 root root 16384 May 14 15:47 lost+found
drwxrwxrwt.  9 root root  4096 May 14 15:55 tmp

 

The umount command can be used to temporarily unmount the /var directory from the /dev/sda3 partition.

umount /var

 

When attempting the unmount, if target is busy is displayed, the -l or --lazy flag can be used.

umount --lazy /var

 

Once unmounted, the /dev/sda3 parition will no longer be included in the df -Th command or in the mount command. Likewise, when attempting to view the contents of the /var directory, the following should be returned.

[root@lab1 ~]# ll /var
total 0

 

The mount command can be used to remount the /var directory onto /dev/sda3.

mount -t ext4 /dev/sda3 /var

 

Or, if the /etc/fstab file is configured to mount the /var directory to the /dev/sda3 parition at boot, restarting the system should mount the /var directory onto the /dev/sda3 parition.

UUID=7a8e7883-e6ee-4482-a7ca-665bfe94eaa8 /var    ext4   defaults   1 2

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter e959b in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |