Linux Mount Command Tutorial With Examples

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-mount-command-tutorial-examples/
PINTEREST
PINTEREST
INSTAGRAM

As we know Linux operating system mainly uses files and folders as operational units. Files an folders are stored in files 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 files systems. In this tutorial we will look different type of usages of mount.

List Mounts

Normally most of the Linux operating systems are started by mounting some file system 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 mounted partition will be accessed.

Mount
Mount

Mount Ext4

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

Mount Ext4
Mount Ext4

Mount NTFS

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

LEARN MORE  Linux Tmux Tutorial With Command Examples

Mount NTFS
Mount NTFS

Mount FAT

FAT is predecessor of the NTFS file system and used wide in different systems like camera, 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 system 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 use after boot.

Mount All File Systems Of Fstab
Mount All File Systems Of Fstab

Unmount All File Systems Of Fstab

In 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 specific mount point. Below is an example fstab file that provides mount configuration for /mnt . We will mount this line by specifying 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  What is File System Block And Super Block?

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 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 current mounted point and new mount point in row with -B parameter. This is actually do not removes old mount only adds new directory as 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 which effects the mount operation. One of the most used option is read/write option. By default file systems are mounted read/write able. 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.

LEARN MORE  Youtube-dl Download Youtube Videos

Lazy Unmount

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

Force Unmount

In previous example we have looked lazy unmount which will wait 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.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/linux-mount-command-tutorial-examples/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.