CentOS

How to Mount CD-ROM on CentOS 8

CDs and DVDs are slowly becoming irrelevant, but they are still efficient data storage devices. They can store data in a large quantity for long periods of time. In this article, we will discuss the mounting process of CD-ROM on CentOS 8 step-by-step. The method we will perform in this article will also work if you want to mount an ISO file on CentOS 8 system.

Step 1: Login as a Root User

In case you’re not a root user or do not have Sudo privileges, please use the command below to log in as a root user:

$ su

You will be asked to input the root password. In case you fail to provide the password, you will not be able to mount the CD-ROM using the commands given in this article since this requires Sudo privileges.

Step 2: Know the Block Device Name

Now that you have logged in as a root user, you will be able to use the blkid command to look at the contents of block devices. Block devices are storage devices like CD ROMs, Hard Drives, and Floppy Disks.

# blkid

The output will look something like the screenshot attached below:

My CD is not showing here, as I have not inserted it yet.

Now, if I use the blkid command again after inserting the CD, the output will have an additional device in the list of block devices:

# blkid

The device in this example is named /dev/sr0.

Please note the block device name you want to mount and its UUID.

Step 3: Create a Mount Point Directory

We need to make a new directory that will act as the mount point for your CD/DVD. Therefore, create a new directory using the mkdir command (any arbitrary directory).

In this example, we will use /media/mount:

# mkdir /media/mount

Step 4: Mount CD/DVD Drive

Now, we have everything to mount a CD/DVD on our CentOS 8 system. We will use the mount command to mount the CD/DVD on CentOS 8 Operating system:

# mount /dev/sr0 /media/mount/

After mounting, you will be able to access all the files on your CD/DVD drive.

You can use the ls command followed by the mount point directory of CD/DVD to check whether the operation was successful or not.

# ls media/mount

You can also mount your CD/DVD drive permanently.

Mount CD/DVD Drive Permanently

To mount a CD/DVD drive permanently, use the nano command followed by /etc/fstab to open the fstab file in the nano editor.

Fstab is a system configuration file in CentOS 8 located in the /etc directory:

# sudo nano /etc/fstab

Add the following entry in the fstab file to mount CD/DVD Drive permanently:

UUID=2021-04-28-16-51-58-26 /media/mount/ iso9660 ro,user,auto 0 0

Change the UUID and mount point according to your need. UUID stands for the universally unique identifier.

Save and exit the file using the keyboard shortcut “CTRL + S” and “CTRL + X” and return to the terminal. Now, you can use the “mount” command to mount your CD/DVD drive permanently:

# mount /dev/sr0 /media/mount/

That’s it, Congratulations! You have permanently mounted a CD drive.

Conclusion

This article has a comprehensive guide on how to mount a CD/DVD ROM on a CentOS 8 system. This method given above can be used to set up any block device on your system.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.