Objective

The objective is to mount a CD/DVD block device with ISO 9660 disk image/media.

Requirements

Privileged access to your Redhat 7 system.

Difficulty

EASY

Conventions

  • # - requires given command to be executed with root privileges either directly as a root user or by use of sudo command
  • $ - given command to be executed as a regular non-privileged user

Instructions

Locate Block device

First we need to find a correct CD/DVD block device. To do this execute a command blkid:
# blkid
/dev/xvda1: UUID="b4f59ae4-f5c8-49c2-94cf-103e10eef407" TYPE="xfs" 
/dev/xvda2: UUID="zcwKzx-w2EM-NH4E-wQW3-7QTu-62JZ-s6Ok0j" TYPE="LVM2_member" 
/dev/sr0: UUID="2016-10-19-18-32-06-00" LABEL="RHEL-7.3 Server.x86_64" TYPE="iso9660" PTTYPE="dos" 
/dev/mapper/rhel-root: UUID="ea637699-1d70-49ef-9a0a-54bc87d1e571" TYPE="xfs" 
/dev/mapper/rhel-swap: UUID="617ccf82-602c-472d-bff6-484d95530293" TYPE="swap" 
Take a note of the relevant block device eg. /dev/sr0 and optionally also take a note of the shown UUID 2016-10-19-18-32-06-00.

Create a mount point

Next, create a new directory or use existing to be used as a mount point:
# mkdir /media/rhel7-repo-iso/

Mount CD/DVD temporarily

At this point you can mount your CD/DVD block device:
# mount /dev/sr0  /media/rhel7-repo-iso/
mount: /dev/sr0 is write-protected, mounting read-only
OR
mount /dev/cdrom  /media/rhel7-repo-iso/
Your CD/DVD files should now be accessible read-only:
# ls /media/rhel7-repo-iso/
addons  EULA  images    LiveOS      Packages       repodata                 RPM-GPG-KEY-redhat-release
EFI     GPL   isolinux  media.repo  release-notes  RPM-GPG-KEY-redhat-beta  TRANS.TBL

Permanent CD/DVD mount using fstab

The above will mount your CD/DVD ROM only temporarily. In order to make this mount permanent after reboot edit /etc/fstab configuration file by adding a following line replacing UUID to match your previous blkid command output:
UUID=2016-10-19-18-32-06-00             /media/rhel7-repo-iso   iso9660 ro,user,auto  0 0 
After the reboot of your RHEL 7 Linux, the system will mount CD/DVD ROM automatically.
redhat 7 mount cdrom dvd block fstab permanent