How To Mount In Linux

When it comes to managing file systems, Linux ranks as one of the most flexible platforms. Among its powerful features is the ability to “mount” and “unmount” file systems seamlessly. In this guide, we’ll delve into the operations of mounting in Linux.

What is Mounting?

Mounting is the process of making a filesystem accessible to the operating system. When a filesystem is mounted, it is attached to a certain point in the directory tree, known as the mount point.

How to Mount in Linux

Here’s the typical syntax of the mount command:

mount [options] [destination]

The ‘options’ are optional settings, ‘source’ is the filesystem that you want to mount, and ‘destination’ is the directory where you want it mounted.

Example of a Basic Mount Command

Suppose you have an external device like a USB flash drive that you want to mount. First, you need to create a mount point, which is just a directory. Let’s create a directory in /mnt:

            sudo mkdir /mnt/usb

Then you can use the mount command to mount the device. In this case, let’s say the device located at /dev/sdb1:

            sudo mount /dev/sdb1 /mnt/usb

Unmounting a Filesystem in Linux

To unmount a filesystem, we use the umount command:

            sudo umount /mnt/usb

Remember, execute this command before you physically remove the device to prevent data loss.

Automatically Mounting Filesystems at Boot

Linux allows you to automatically mount filesystems when the system boots. This can be done by editing the /etc/fstab file.

Each line in the fstab file represents a filesystem, with fields separated by spaces or tabs:

            [file system] [mount point]   [type]  [options]       [dump]  [pass]

For instance, to auto-mount our example USB drive:

            /dev/sdb1   /mnt/usb   auto    defaults    0   0


Mounting in Linux might seem complex, but once you understand its concept, it becomes easier. With this guide, you should be able to mount and unmount filesystems in Linux effectively.