Identify inserted recordable media type

May 21, '09 07:30:00AM

Contributed by: robg

A reader emailed me a question; he wanted to know how to identify what sort of recordable media (CD-R, CD-RW, DVD-R, etc.) was in his machine's optical drive. Obviously, you could hit the eject button to answer the question, but I wondered if the system would be able to help. After a bit of testing, I found three ways to find this info, though I suspect there may be more.

The first solution is to use System Profiler (hold down the Option key, click the Apple menu, select System Profiler). Select Disc Burning in the Contents column, click on your optical drive in the Burning Device section of the window, and then look in the Media section below -- you'll see not only the media type, but also whether or not it's blank, erasable, overwritable, appendable, and the disc's available write speeds. This is the most-detailed information about the inserted media that I was able to find.

The second solution is to use Disk Utility, in Applications » Utilities. Select your optical drive in the sources list, and then look at the bottom of the Disk Utility window. Among the other items shown is Media Type, and that answers the question -- it will read CD-R, DVD-R, DVD-ROM, etc. based on what's inserted in the drive.

The final solution works in Terminal (also in Applications » Utilities). diskutil is somewhat like Disk Utility for the command line; it can provide a lot of information about the drives in your machine. First, though, you need to know the device ID for your optical drive. If you already know your optical drive's ID (let's say it's /dev/disk3), you can see what type of media is inserted by typing diskutil info /dev/disk3. In the output, you'll see an entry for Optical Media Type which tells you exactly what type of media is in the drive.

If you don't know your optical drive's device ID, read on for one way to find it using Terminal.

Assuming you've already inserted a blank disc of some sort, you can find your optical drive's device ID by running diskutil list | grep "0.0 B" in Terminal (the 0.0 B bit searches for discs with absolutely nothing stored on them). Alternatively, just type diskutil list and look through the output for a drive without any entry in the TYPE or NAME column (again, assuming it's a new, blank disc).

In either case, you're looking for the /dev/disknn (where nn is some number, typically only a single digit) value that appears in the left-hand column of the output. That's your device ID to use in the diskutil info command.

If you know of other ways of determining the type of inserted media, and/or an easier way to get the optical drive's ID, please post in the comments.

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20090521053011361