Solaris, determine if inserted disk is CD or DVD

Posted on 2011-10-14
Last Modified: 2012-05-12
I am using Solaris 10.
According to Oracle's system admin manual, inserted CDs and DVDs are mounted as a subdirectory in /cdrom.
I find it strange that DVDs don't have their own mount directory.

How can I determine if a device a CD or a DVD? Because the method of writing data would differ depending on this.
Question by:bejhan
    LVL 5

    Expert Comment

    # cfgadm -al
    LVL 16

    Expert Comment

    Using command
    # iostat -En

    should show the device is a DVD-ROM or a CD-ROM.
    LVL 40

    Expert Comment

    mounting of cd or dvd should not be a problem. You may try to use

    /usr/platform/`uname -i`/sbin/prtdiag


    /usr/platform/`uname -m`/sbin/prtdiag

    to find your server hardware details
    LVL 9

    Expert Comment

    Do you intend to write CD/DVDs with tools like cdrdao/growisofs?
    LVL 1

    Author Comment

    Going to look into all of your replies, just tied up temporarily with something else.

    svs: I do not know which tools will be used, I am doing this research preemptively. Is there a reason you ask?
    LVL 1

    Author Comment

    I think I may have worded my question badly, because none of you seems to understand what I am after.
    I want to know how to tell whether the inserted disk is a CD or a DVD (or even a BD). Because when you have a blue-ray drive, for example, all of these types of disks are able to be burned, but the process in doing so will be different.

    See below as to why your answer did not suffice:

    hossamshaaban: cfgadm -al does not describe whether the inserted disk is CD or DVD, just that the drive is CD/DVD compliant.
    Ap_Id                          Type         Receptacle   Occupant     Condition
    sata0/2::dsk/c1t2d0    cd/dvd     connected    configured   ok

    Open in new window

    ganjos: iostat -En does not describe whether the inserted disk is CD or DVD, just drive information (not even what types are supported).
    c0t1d0           Soft Errors: 0 Hard Errors: 3 Transport Errors: 0
    Vendor: ATAPI    Product: iHAS124   Y      Revision: BL0V Serial No:
    Size: 0.00GB <8192 bytes>
    Media Error: 0 Device Not Ready: 2 No Device: 1 Recoverable: 0
    Illegal Request: 47 Predictive Failure Analysis: 0

    Open in new window

    omarfarid: /usr/platform/`uname -i`/sbin/prtdiag does not describe whether the inserted disk is CD or DVD, just motherboard information (not even information about the optical disk drive).
    System Configuration: System manufacturer System Product Name
    BIOS Configuration: American Megatrends Inc. 1305 02/11/2011
    ==== Processor Sockets ====================================
    Version                          Location Tag
    -------------------------------- --------------------------
    Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz LGA1155
    ==== Memory Device Sockets ================================
    Type    Status Set Device Locator      Bank Locator
    ------- ------ --- ------------------- --------------------
    Unknown in use 0   DIMM0               BANK0
    Unknown in use 0   DIMM1               BANK1
    Unknown in use 0   DIMM2               BANK2
    Unknown in use 0   DIMM3               BANK3
    ==== On-Board Devices =====================================
    Onboard Ethernet
    ==== Upgradeable Slots ====================================
    ID  Status    Type             Description
    --- --------- ---------------- ----------------------------
    1   in use    PCI Express      PCIEX16_1
    2   in use    PCI Express      PCIEX1_1
    3   in use    PCI Express      PCIEX1_2
    4   in use    PCI              PCI1

    Open in new window

    LVL 16

    Expert Comment

    Product:ATAPI iHAS124 Y is a "SCSI CdRom Device"
    LVL 1

    Author Comment

    iostat -En doesn't return that information, you had to look it up, and that still doesn't tell me what the type of the inserted disk is!

    I am looking for a programatic way to determine if the inserted disk is a CD, DVD or BD so that when my application attempts to write data to the disk it knows how to do so.
    LVL 9

    Accepted Solution

    Send some raw SCSI commands to the device, interpret the results.  Look how cdrtools does it: prdiskstatus() in cdrecord/scsi_mmc.c

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
    Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
    Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now