Mac OSX : Controlling your CD/DVD Drive from the command line

One of the things I love about my Mac is the access to the *nix command line.  Controlling your CD/DVD drive from the GUI is something that may work well on a “real” mac, but on my “hackintosh”, some times it doesn’t work as expected.

The command to work with the optical drive is drutil :

localhost:log glaw$ drutil –help
Usage: drutil -drive [drive-arguments] command [command-options-and-arguments]
drutil commands are:
atip           Displays ATIP information about inserted CD-R/RW media.
bulkerase      Bulk erases -RW media in either quick or full mode.
drutil bulkerase (quick | full)
burn           Burns a given file or directory to disc.
drutil burn (burn-options) <path>
cdtext         Displays CD-Text present on an audio CD.
discinfo       Displays disc related info when media is present.
dumpiso        Parses ISO-9660 directory structures.
drutil dumpiso <devnode> <block> [format]
dumpudf        Parses UDF directory structures.
drutil dumpudf <devnode> <block> [format]
eject          Ejects media from the drive (if any).
erase          Erases -RW media in either quick or full mode.
drutil erase (quick | full)
filename       Translates filenames for different filesystems.
drutil filename <name>
getconfig      Displays current and supported device features and profiles.
drutil getconfig (current | supported)
info           Displays detailed information about connected drives.
list           Lists all connected burning devices.
poll           Constantly polls and displays device notifications.
size           Estimates size of a given file or directory.
status         Displays detailed information about inserted media.
subchannel     Displays subchannel (MCN, ISRC) info when CD media is present.
toc            Displays TOC information about inserted CD media.
trackinfo      Displays track related info when media is present.
tray           Opens and closes drive tray, and ejects media.
drutil tray (open | close | eject)
version        Display the OS and DiscRecording version numbers.
(specify drutil help <command> for command specific help)
(specify drutil help driveselect for drive selection help)

localhost:log glaw$ drutil status
localhost:log glaw$ drutil tray open
localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: No Media Inserted

localhost:log glaw$ sudo drutil tray open
localhost:log glaw$ sudo drutil tray eject
localhost:log glaw$ sudo drutil discinfo
localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: No Media Inserted

localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: CD-ROM               Name: /dev/disk2
Sessions: 1                  Tracks: 10
Overwritable:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Free:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Used:   39:12:45         blocks:   176445 / 361.36MB / 344.62MiB
Writability:

localhost:log glaw$ sudo drutil tray eject
localhost:log glaw$ sudo drutil tray eject
Password:
localhost:log glaw$ sudo drutil status
Password:
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: No Media Inserted

localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: No Media Inserted

localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: No Media Inserted

localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: CD-ROM               Name: /dev/disk2
Sessions: 1                  Tracks: 1
Overwritable:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Free:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Space Used:   79:43:62         blocks:   358787 / 734.80MB / 700.76MiB
Writability:

localhost:log glaw$ sudo drutil status
Password:
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: No Media Inserted

localhost:log glaw$ sudo drutil status
Vendor   Product           Rev
PIONEER  DVD-RW  DVR-111D  1.29

Type: CD-R                 Name: /dev/disk2
Write Speeds: 4x, 10x, 16x, 24x, 32x, 40x
Overwritable:   79:57:72         blocks:   359847 / 736.97MB / 702.83MiB
Space Free:   79:57:72         blocks:   359847 / 736.97MB / 702.83MiB
Space Used:   00:00:00         blocks:        0 /   0.00MB /   0.00MiB
Writability: appendable, blank, overwritable




Comments are Closed