Linux Mount Command Tutorial With Examples – POFTUT

Linux Mount Command Tutorial With Examples

As we know Linux operating system mainly uses files and folders as operational units. Files folders are stored in file systems and disks. There are different tools to manage file systems and disks. But mount is de facto command used to mount and list disks and file systems? In this tutorial, we will look at different types of usages of the mount.

List Mounts

Normally most of the Linux operating systems are started by mounting some file systems for system partition and user partition. The mounted partitions can be changed according to configuration. These partitions and file systems can be listed just issuing mount command like below. In this example we can see that are are some psedeu partitions those used by operations system-related functionalities.

List Mounts

List Mounts

Mount

Mount file systems and partitions are not so hard or complex in the command line. To mount just provide the partitions that will be mounted and the destination where the mounted partition will be accessed.

Mount

Mount

Mount Ext4

In the previous example, we have mounted a partition without specifying a file system. Because the mount is decided the partitions file system automatically and set required parameters internally without needing any additional information. But sometimes this can not work. We can specify the file system type with -t parameter like below. In this example, we will mount the ext4 file system.

Mount Ext4

Mount Ext4

Mount NTFS

As we know NTFS is a Windows native file system. The mounting NTFS file system is very similar. NTFS provides a reach feature set like the BTRFS file system which is used by some of the distributions. We can see from mount output that NTFS is named fuseblk .

LEARN MORE  Windows WMIC (Windows Management Interface Command) Tutorial with Examples

Mount NTFS

Mount NTFS

Mount FAT

FAT is the predecessor of the NTFS file system and used wide in different systems like cameras, TV, etc. FAT file systems can be specifically mounted like below.

Mount FAT

Mount FAT

Mount CD-Rom

CD-ROM is old technology nowadays. But the CD-ROM de facto file system ISO is used regularly for distribution of Linux distributions, Setup tools, etc. These ISO file systems can be mounted with the following command.

Mount CD-Rom

Mount CD-Rom

Mount All File Systems Of Fstab

Up to now we have mounted file systems by giving details. There is a configuration file used by mount which resides /etc/fstab . This file is used to mount file systems during boot time. But this configuration file can be used after boot.

Mount All File Systems Of Fstab

Mount All File Systems Of Fstab

Unmount All File Systems Of Fstab

In the previous example, we have used fstab file as mount configuration but this can be also used as unmount configuration to unmount all file systems specified in fstab.

Mount Specific File Systems Of Fstab

Fstab can be used to get mount configuration of the specific mount points. Below is an example fstab file that provides mount configuration for /mnt . We will mount this line by specifying the mount path.

And we mount /mnt

Mount Specific File Systems Of Fstab

Mount Specific File Systems Of Fstab

List Mounted File Systems

Mounted file systems can be listed with -l parameter.

LEARN MORE  Linux Qemu-img Command Tutorial With Examples to Create, Change, Shrink Disk Images

List Mounted File Systems

List Mounted File Systems

List Mounted Ext3 File Systems

While listing specific file systems can be specified to be listed. This can be used

List Mounted Ext4 File Systems

Ext4 file systems can be listed with the -t ext4 parameter like below.

List Mounted Ext4 File Systems

List Mounted Ext4 File Systems

List Mounted Btrfs File Systems

Btrfs file systems can be a list with the -t btrfs like below.

Bind Mount To New Directory

After mounting to a directory the mount point can be changed. We will provide the current mounted point and new mount point in a row with -B parameter. This actually does not removes old mount only adds the new directory as the mount.

Bind Mount To New Directory

Bind Mount To New Directory

Mount File System Read Only

While mounting file systems there are a lot of options that effects the mount operation. One of the most used option is to read/write option. By default file systems are mounted read/writeable. But there are some situations we need to mount read-only. Mount can mount read-only with -r

Mount File System Read Only

Mount File System Read Only

Remount Mounted File System

All ready mounted file systems can be remounted easily with -o mount parameter. This is needed some times some configurations about the file system is changed and make new configuration effective.

Unmount Multiple Mounts

Previously we have mounted multiple mount points. Now we may want to unmount the multiple mount points with the following commands.

Lazy Unmount

Unmounting have some restrictions. While there are operations on the mounted partitions these partitions can not be unmounted. This can be an unwanted situation. There is a workaround which will unmount the system after the operation on the mount point.

LEARN MORE  How To Download and Install Kali Security and Penetration Test Linux Distribution?

Force Unmount

In the previous example, we have looked lazy unmount which will wait for the operation to end in order to unmount the mount point. There is a hard way which will forcibly unmount the mount point. But keep in mind that this can create problems with file systems.

1 Response

  1. 01/06/2018

    […] Linux Mount Command Tutorial With Examples […]

Leave a Reply

Your email address will not be published. Required fields are marked *