Drives can be mounted using the mount utility, typically used with arguments.

The syntax for the mount command is as follows:

mount [options] -t filesystem-type -o mount-options device directory

Arguments

-v: Get detailed information during the operation.
-h: Display help.
-V: Display the software version.
-a: Mount all devices listed in fstab.
-F: Create a unique mount instance for each partition.
-f: "Fake execution." Allows you to indirectly see the result of the command.
-n: Do not log mounting data to Mtab.
-l: Add the drive label to the mount point.
-c: Use only absolute paths.
-r: Mount for read-only access.
-w: Mount for read and write access.
-L: Mount by label.
-U: Mount by UUID.
-B: Mount a local directory.
-R: Remount a local directory.

Mounting with Mount

Mounting drives using the mount utility is quite straightforward. Just enter the command with the partition you want to mount as an argument, along with the directory where you want to mount it.

You can obtain a list of all existing partitions with the following command:

fdisk -l

For example, let's mount the partition nvme1n1p3 to the /mnt directory:

sudo mount /dev/nvme1n1p3 /mnt/

To unmount, use the following command:

sudo umount /mnt

You can view a list of all mounted devices easily with:

mount

Mounting by UUID

To obtain information about the UUIDs of your server's partitions, use the following command:

sudo blkid

Then, open the configuration file that contains information about all system partitions mounted at boot:

sudo nano /etc/fstab

Depending on the filesystem, add a line with appropriate parameters to this file. For instance, to mount an NTFS partition:

UUID="0x0x0x0x0" /mnt/myfolder rw,nls=utf8,gid=plugdev,umask=0002 0 0

For FAT and FAT32 filesystems, you can use:

UUID="0x0x0x0x0" /mnt/myflash vfat rw,exec,codepage=866,nls=utf8,gid=plugdev,umask=0002,nofail,users 0 0

Where "UUID=" represents the UUID of the drive to be mounted, and "/mnt/..." is the location where the drive should be mounted.

To apply the changes (mount the drives), use the following command:

sudo mount -a

Conclusion

There you have it! You've learned how to manually mount drives. This article is relevant for most Linux distributions.