Rocky Linux

How to Mount a USB Drive on Rocky Linux 9

Mounting a USB drive in the operating system helps you to quickly access, read, and write it. After working on a USB drive, it is essential to unmount it before physically removing it from the system. However, the system does not automatically detect the USB in some cases, so you must mount it manually.

Although mounting a USB drive in the operating systems like Windows is easy, it’s not the same in the case of Rocky Linux 9. As a beginner, mounting a USB drive on Rocky Linux always becomes confusing. In this short tutorial, we will describe the complete steps to mount a USB drive on Rocky Linux 9.

How to Mount a USB Drive on Rocky Linux 9

It is simple to mount a USB drive. Connect the USB drive to your system and run the following command in the terminal:

sudo lsblk

The lsblk command lists the blocked devices such as flash drives, hard disks, optical media, USB drives, etc. Similarly, you can also use the -l option to get the output in the list format:

sudo lsblk -l

Usually, the lsblk command lists the connected USB drive in the /dev/sdc or /dev/sdb format. Moreover, you can also use the fdisk -l command to list the available disks and drives in a more detailed manner:

sudo fdisk -l

Once you see the connected USB drive that is listed in the previous output, it is time to create the mount point directory. For example, let’s create the new directory, USB in /mnt, through the mkdir command:

sudo mkdir /mnt/USB

Now, you can mount the connected USB drive to the mount point directory through the following command:

sudo mount /dev/sdb /mnt/USB

Here, /dev/sdb represents the USB drive, and /mnt/USB represents the mount point directory. If you want to verify if the system has successfully mounted the USB, run the following command:

mount | grep sdb

Finally, you can access the USB drive’s data through the cd command with the path of the mount directory:

cd /mnt/USB

How to Unmount a USB Drive

To unmount the USB drive on Rocky Linux 9, you only need to add the path of the mount directory with the umount command:

umount /mnt/USB

Conclusion

This is all about the ways that you can use to mount a USB drive on Rocky Linux 9. Moreover, we also included a simple command to unmount a USB drive quickly. Remember to always unmount the USB drive before you remove it from the system to avoid data loss.

About the author

Prateek Jangid

A passionate Linux user for personal and professional reasons, always exploring what is new in the world of Linux and sharing with my readers.