Obtainining info on the optical drive in a CentOS Linux system

If you need to determine the manufacturer, type, or model of optical disc drive that is in a CentOS Linux system, you can log into the root account and use the dmesg command and pipe the output into the egrep command looking for key terms, such as "cdrom", "dvd", "cr/rw", or "writer" as shown below:

# dmesg | egrep -i 'cdrom|dvd|cd/rw|writer'
[    1.571327] ata1.00: ATAPI: TSSTcorpCD/DVDW SH-S182M, SB02, max UDMA/33
[    1.598476] scsi 0:0:0:0: CD-ROM            TSSTcorp CD/DVDW SH-S182M SB02 PQ: 0 ANSI: 5
[    1.635809] sr 0:0:0:0: [sr0] scsi3-mmc drive: 48x/48x writer dvd-ram cd/rw xa/form2 cdda tray
[    1.635819] cdrom: Uniform CD-ROM driver Revision: 3.20
#

You can view information about the capabilities of the drive, such as its speed and the types of discs it can read from and write to by viewing the contents of /proc/sys/dev/cdrom/info.

Udemy - April2516-25off-sitewide120x600








# cat /proc/sys/dev/cdrom/info
CD-ROM information, Id: cdrom.c 3.20 2003/12/17

drive name:             sr0
drive speed:            48
drive # of slots:       1
Can close tray:         1
Can open tray:          1
Can lock tray:          1
Can change speed:       1
Can select disk:        0
Can read multisession:  1
Can read MCN:           1
Reports media changed:  1
Can play audio:         1
Can write CD-R:         1
Can write CD-RW:        1
Can read DVD:           1
Can write DVD-R:        1
Can write DVD-RAM:      1
Can read MRW:           1
Can write MRW:          1
Can write RAM:          1


#

I can see from the value of "1" for "DVD-R" that the device can write to DVD-R discs.

If you have the cd-drive tool on the system, you can also use it to view information on a CD or DVD drive in the system.

# which cd-drive
/bin/cd-drive
# cd-drive
cd-drive version 0.92 x86_64-redhat-linux-gnu
Copyright (c) 2003-2005, 2007-2008, 2011-2013 R. Bernstein
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
The driver selected is GNU/Linux
The default device for this driver is /dev/cdrom

Drivers available...
  GNU/Linux ioctl and MMC driver
  cdrdao (TOC) disk image driver
  bin/cuesheet disk image driver
  Nero NRG disk image driver

CD-ROM drive supports MMC 3

                       Drive: /dev/cdrom
Vendor                      : TSSTcorp
Model                       : CD/DVDW SH-S182M
Revision                    : SB02
Profile List Feature
        DVD-R - Double-Layer Sequential Recording
        DVD-R - Double-layer Jump Recording
        DVD+R Double Layer - DVD Recordable Double Layer
        DVD+R - DVD Recordable
        DVD+RW - DVD Rewritable
        Re-recordable DVD using Sequential Recording
        Re-recordable DVD using Restricted Overwrite
        Re-writable DVD
        Re-recordable DVD using Sequential recording
        Read only DVD
        CD-RW Re-writable Compact Disc capable
        Write once Compact Disc capable
        Read only Compact Disc capable

Core Feature
        ATAPI interface

Morphing Feature
        Operational Change Request/Notification not supported
        Synchronous GET EVENT/STATUS NOTIFICATION supported

Removable Medium Feature
        Tray type loading mechanism
        can eject the medium or magazine via the normal START/STOP command
        can be locked into the Logical Unit

Write Protect Feature

Random Readable Feature

Multi-Read Feature

CD Read Feature
        C2 Error pointers are supported
        CD-Text is supported

DVD Read Feature

Random Writable Feature

Incremental Streaming Writable Feature

Formattable Feature

Management Ability of the Logical Unit/media system to provide an apparently defect-free space. Feature

Restricted Overwrite Feature

MRW Feature

DVD+RW Feature

DVD+R Feature

Rigid Restricted Overwrite Feature

CD Track at Once Feature

CD Mastering (Session at Once) Feature

DVD-R/RW Write Feature

Unknown code 33 Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Profile List Feature

Hardware                                  : CD-ROM or DVD
Can eject                                 : Yes
Can close tray                            : Yes
Can disable manual eject                  : Yes
Can select juke-box disc                  : No

Can set drive speed                       : No
Can read multiple sessions (e.g. PhotoCD) : Yes
Can hard reset device                     : Yes

Reading....
  Can read Mode 2 Form 1                  : Yes
  Can read Mode 2 Form 2                  : Yes
  Can read (S)VCD (i.e. Mode 2 Form 1/2)  : Yes
  Can read C2 Errors                      : Yes
  Can read IRSC                           : Yes
  Can read Media Channel Number (or UPC)  : Yes
  Can play audio                          : Yes
  Can read CD-DA                          : Yes
  Can read CD-R                           : Yes
  Can read CD-RW                          : Yes
  Can read DVD-ROM                        : Yes

Writing....
  Can write CD-RW                         : Yes
  Can write DVD-R                         : Yes
  Can write DVD-RAM                       : Yes
  Can write DVD-RW                        : No
  Can write DVD+RW                        : No

#

The utility is provided by the libcdio package.

# rpm -q --whatprovides /bin/cd-drive
libcdio-0.92-1.el7.x86_64

You can see details of the RPM package, if it is installed with the command rpm -qi libcdio.

# rpm -qi libcdio
Name        : libcdio
Version     : 0.92
Release     : 1.el7
Architecture: x86_64
Install Date: Sun 05 Oct 2014 07:29:37 PM EDT
Group       : System Environment/Libraries
Size        : 596737
License     : GPLv3+
Signature   : RSA/SHA256, Thu 03 Jul 2014 10:38:38 PM EDT, Key ID 24c6a8a7f4a80eb5
Source RPM  : libcdio-0.92-1.el7.src.rpm
Build Date  : Mon 09 Jun 2014 03:42:09 PM EDT
Build Host  : worker1.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.gnu.org/software/libcdio/
Summary     : CD-ROM input and control library
Description :
This library provides an interface for CD-ROM access. It can be used
by applications that need OS- and device-independent access to CD-ROM
devices.
#

If it isn't installed, you can install it with yum install libcdio .

Related articles:

  1. Obtaining hard disk drive and optical drive information on an Ubuntu system