Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use disktool and System Profiler to eject stubborn CDROM discs UNIX
I recently purchased a Pioneer DVR-A06U DVD±R/RW to replace my failing DVD-ROM which shipped in my G4/400. This is the PC retail version of Apple's SuperDrive, compatible with all of Apple's iApps and is also bootable.

Excited to put my new drive through it's paces, I ran Toast 6 and burned a CD. When it was done, I clicked the eject button in Toast, but the drive tray did not open. I went to Finder to try and drag the CD to the trash, only there was no CD mounted to drag to Trash. So I pressed the physical eject button and nothing. The eject button on my keyboard and the Eject menu extra also failed to open the drive tray so I could remove my CD.

Figuring this was a bug in Toast, I used my trusty straightened paperclip to manually release the drive tray via the emergency eject hole--found on the front of almost every optical drive ever made--and removed my CD. Only problem is that any CD I inserted into the drive after that did not mount and even worse, the drive didn't even show up in Disk Utility! I proceeded to restart my system only to have it hang at shutdown. A forced reboot later and my drive is working fine again, happily ejecting CDs every which way I want to.

A week goes by and one day it happens again, only this time I wasn't using Toast, I was simply ejecting a CD from the Finder using the eject button on my keyboard. The volume unmounts, but the drive tray doesn't eject the physical media. Because the volume is already unmounted, I can't use any of the standard methods of ejecting a disk from Finder (i.e.: dragging to Trash, Cmd-E or choosing eject from the File menu).

Read the rest of the hint for the solution...

All other methods of ejecting CDs on the Mac that I know of also failed to eject the physical media including:

  • Eject button on front of drive.
  • Eject button on my keyboard.
  • Eject buttons in iTunes, Disk Utility or Toast.
  • Mac OS X Eject menu extra.
  • Eject Me! or Ejection Seat, a couple of shareware apps for ejecting stubborn CDs.
  • This time I refused to reboot my Mac! I searched around on the internet and came across this hint at osxfaq.com, by Adrian Mayo, about using the Terminal command disktool -l to list all mounted volumes and the associated BSD disk numbers to identify which disk to eject using the disktool -e disk# command (where # is the corresponding BSD disk number). Only problem is that as before, the volume had already been unmounted, so the drive didn't show up when using the disktool -l command.

    On a whim, I ran System Profiler (Apple menu -> About This Mac -> More Info, or by running /Applications -> Utilities -> System Profiler). Not only did the drive appear there under ATA devices, but it also listed the unmounted volume of the disc that was stuck in the drive AND the BSD disk#, which it listed as "disk3". So I fired up Terminal and typed:

    disktool -e disk3 [Return]

    My drive magically popped open and I was able to remove the CDROM. Not only that, but the drive functioned normally from that point on as I inserted different CDs and ejected them and even burned a few. No paperclip or restart necessary!

    I'm sure there is an easy way to make this hint a double-clickable script, but I'll leave that for someone to post in the comments section. Hope this will help anyone else who is experiencing this problem. I gather from what I have found on the internet that I am not the only person to run into this issue.

        •    
    • Currently 2.75 / 5
      You rated: 2 / 5 (12 votes cast)
     
    [52,668 views]  

    Use disktool and System Profiler to eject stubborn CDROM discs | 27 comments | Create New Account
    Click here to return to the 'Use disktool and System Profiler to eject stubborn CDROM discs' hint
    The following comments are owned by whoever posted them. This site is not responsible for what they say.
    User disktool and System Profiler to eject stubborn CDROM discs
    Authored by: PeterV on Dec 10, '03 11:44:07AM

    I had this self same problem when I first installed my Pioneer A03 drive. I tracked the problem down to the drive going to sleep when my G4 went to sleep. I stopped my G4 from sleeping and haven't had a problem since.

    I do remember seeing a mention of a utility that sets a preference to tell drives to never sleep, separate to the Mac's sleep. I've no idea what it's called or whether that would stop the problem and still allow your Mac to sleep. I never bothered trying it... I'd got the thing working, so worked on the premise of "if it ain't broke, don't fix it!" :-)

    Peter



    [ Reply to This | # ]
    Spindownfix utility
    Authored by: kdawg on Dec 10, '03 12:45:15PM

    I think the utility your thinking of is called Spindownfix. This problem is documented on xlr8yourmac.com within the drive database archive. I too have the same problem. I have a Memorex 52MAXX 3252AJ. My solution has been not to leave a CD in the drive long enough to let the drive sleep. This seems to be a problem with OSX and third party CD drives not Toast.

    The never put your Mac to sleep option doesn't seem to be the best solution because I leave my Mac on 24/7 as I'm sure most of you do too. Hopefully Apple has a fix for this in the near future.



    [ Reply to This | # ]
    Spindownfix utility
    Authored by: taikahn on Dec 10, '03 01:00:52PM

    same problem here --

    I simply choose to not sleep... and mine is on 24/7 ... not much else we can do ...

    has anyone tried flashing the firmware (to the newest pioneer version) in a pc and then returning it to a mac... ???

    ---
    ---
    Some people (still) think the world is flat...



    [ Reply to This | # ]
    Firmware update
    Authored by: acalado on Dec 10, '03 01:06:44PM

    I searched the Pioneer support web site and couldn't find any firmware updates for my drive (Pioneer DVR-A06U). Probably aren't any yet as this drive is still pretty new I think...

    Andy



    [ Reply to This | # ]
    Firmware update
    Authored by: kdawg on Dec 10, '03 02:24:33PM

    Did you look here.
    http://www.pioneerelectronics.com/pna/article/0,,2076_4249_2370254,00.html



    [ Reply to This | # ]
    Firmware update
    Authored by: acalado on Dec 10, '03 03:06:41PM

    Guess I didn't search hard enough...

    Do they make Mac updaters available? I really don't feel like moving the drive to a PC to install it. An alternative would be to run the updater in Virtual PC, but I'd be worried what would happen if it didn't work...

    Andy



    [ Reply to This | # ]
    Firmware update
    Authored by: PigDawg on Dec 11, '03 11:11:55AM

    The updater won't work in Virtual PC without some extra hardware. VPC doesn't have direct hardware access to an ATA drive such as your Pioneer drive (I have the same one.) But for some reason VPC does have direct hardware access to the drive if its connected through USB. This means that if you have an external USB case and you install your Pioneer drive in it you should be able to run the firmware updater in VPC.

    Note: external firewire will not work. Only USB will work.

    That latest firmware version for the A06/106 is 1.07. There is a cracked, region free version available out there if you know where to look. Also, there is no native Mac firmware updater for this drive.



    [ Reply to This | # ]
    User disktool and System Profiler to eject stubborn CDROM discs
    Authored by: Lt. Dan on Dec 10, '03 09:00:18PM

    I also upgraded my G4/400 to an A05. Under Jaguar, my computer will go into a total kernel panic (Black screen and white text over my OS X desktop) if I leave any CD, DVD in the drive for any length of time without using. It is totally unrecoverable without a power button reboot. I tried updating firmware through Pioneer with no success. I avoid the crash by not leaving CD's in the drive. Everything else work fine. I am going to try the Spin utility mentioned. I have since upgraded to Panther but have not put the machine in a condition to crash ... Yet. I wish Apple would provide the neccesary Firmware that they put in "factory" drives.



    [ Reply to This | # ]
    User disktool and System Profiler to eject stubborn CDROM discs
    Authored by: Juan Cardona on Dec 11, '03 10:59:04AM

    Simpler than all of comments:
    1. Put your mac to sleep,
    2. Wake-up it
    3. The CDROM appears in the desktop as always, is ejectable again.

    ---
    jct



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: LC on Dec 10, '03 01:00:51PM
    Do you think that lsof would show any indication of that device possibly being in use?

    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: Frederico on Dec 10, '03 11:38:56PM

    We've been seeing this a lot in Panther suddenly; it also tends to occur frequently in CD-ROM-only drives. Solution: use Fast User Switching to log into another account (root seems to work best), where the disk will "remount", and now will eject properly. Logout and return to the original user and keep moving. Not sure if this method is faster or not; the need to do either is becoming more than annoying, and will hopefully be resolved in 10.3.2.



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: egilDOTnet on Dec 11, '03 08:07:12AM

    I have a similar problem when I am to quick taking my USB drive out of my laptop. I receive a warning on the screen that this was a premature thing to do and wait until the disk disappears from the desktop (which it allready have, btw). But when I reinsert the disk, it does not show up. Never. Not until after I reboot. Anyone seen this?



    [ Reply to This | # ]
    Use disktool and system_profiler
    Authored by: jyncroft on Dec 11, '03 10:13:31AM

    Great hint!

    For a complete command-line solution (maybe help someone do a script/GUI implementation) use the system_profiler (used to be AppleSystemProfiler on pre 10.3 systems I think).

    Warning: do not use the system_profiler command by itself. Nothing bad will happen mind you, but it will spew out gobs and gobs (did I mention gobs) of data. use man system_profiler to narrow down your quest for data.

    system_profiler SPIDEDataType will get you the IDE disk (incl. internal CD drives) information. You'll have to use a different DataType (see the man pages) to get info for drives connected via another interface.

    Hope this helps!

    Jennifer

    [ Reply to This | # ]

    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: Eravau on Dec 11, '03 06:14:05PM
    Save the following perl script where you like, make it executable, and then run it from the command line to find an ATA/IDE CD and eject it. It will eject the first CD it finds and then exit...although with a little more work, it could continue to eject disks until they're all ejected. I only have ATA/IDE drives, so I can't test with other kinds...but it should work with others since it's checking the IDE, USB, and FireWire buses. If you find that it doesn't, please email me a spit-out of your /usr/sbin/system_profiler SPIDEDataType SPUSBDataType SPFireWireDataType and I'll work on any necessary modifications. This script will only work on OS X 10.3 Panther. The AppleSystemProfiler from pre-10.3 does not provide the necessary BSD name to make this work...and doesn't appear to take any of the flags of the 10.3 system_profiler.

    --- Script Begins Below This line ---

    
    #!/usr/bin/perl
    
    #  Get The Info For All IDE, USB, & FireWire Devices
    # ---------------------------------------------------
    @profile_data = `/usr/sbin/system_profiler SPIDEDataType SPUSBDataType SPFireWireDataType`;
    
    #  Misc. Settings
    # ----------------
    $no_of_lines  = @profile_data;
    $line_no      = 0;
    
    #  Find The First CD/DVD and Eject It
    # ------------------------------------
    while ($line_no <= $no_of_lines) {
    	$profile_line = $profile_data[$line_no];
    	if ($profile_line =~ /Drive Type.* CD-R/) {
    		++ $line_no;
    		while ($line_no <= $no_of_lines) {
    			$profile_line = $profile_data[$line_no];
    			if ($profile_line =~ /BSD Name.* (disk\S+)/) {
    				$bsd_name = $1;
    				print "Ejecting $bsd_name\n";
    				system ("/usr/sbin/disktool -e $bsd_name > /dev/null");
    				exit;
    			}
    			++ $line_no;
    		}
    	}
    	++ $line_no;
    }
    print "No disk found to eject.\n";
    
    --- Code ends above this line ---

    If you want a double-clickable, keyboard-shortcutable, etc. version, you can wrap it in the following AppleScript (which assumes you saved the perl script at /usr/local/bin/eject_disk):
    --- Code begins below this line ---

    
    do shell script "/usr/local/bin/eject_disk"
    set resp to the result
    display dialog (resp as text) buttons {"OK"} default button "OK"
    
    --- Code ends above this line ---

    If you just want the AppleScript to eject and not tell you what it's doing, then take out the display dialog... line. If you want the perl script to shutup from the command line, just comment out any print lines (or take them out altogether).

    -Eravau
    See my Photo of the Day

    [ Reply to This | # ]

    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: pmccann on Dec 11, '03 07:32:08PM
    Just a quick suggestion: instead of chasing line numbers (that you're not really interested in anyway), maybe just set a flag for when you've hit the "CD-R" line, then search for the next "BSD Name" line after that. Here's a rewrite of the script with just those changes.
    
    #!/usr/bin/perl
    use warnings;
    use strict;
    #  Get The Info For All IDE, USB, & FireWire Devices
    # ---------------------------------------------------
    my @profile_data = `/usr/sbin/system_profiler SPIDEDataType SPUSBDataType SPFireWireDataType`;
    my $found;
    
    #  Find The First CD/DVD and Eject It
    # ------------------------------------
    foreach (@profile_data){
    $found=1 if /Drive Type.* CD-R/;
    if ($found && /BSD Name.* (disk\S+)/){
    my $bsd_name=$1; 
    print "Ejecting $bsd_name\n";
    system ("/usr/sbin/disktool -e $bsd_name > /dev/null");
    exit;
    }
    }
    print "No disk found to eject.\n";
    
    Cheers, Paul

    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: ber on Dec 11, '03 09:28:39PM

    If your CD isn't mounted for some reason (like - I thought there was a CD in there but I guess not) this program will eject the next BSD device it finds. In my case it was a firewire disk.



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: Eravau on Dec 12, '03 09:47:11AM
    Ok...it took me a few minutes to realize what the problem was (i.e. that there is no BSD name for a disk that's not there, so it just went 'til it found any BSD name after finding a removable media drive). Here's the re-write (on top of pmccann's edits) with the appropriate modification to stop it from hitting the wrong disk when there's no removable media in the first drive it hits...

    
    #!/usr/bin/perl
    
    use warnings;
    use strict;
    
    #  Get The Info For All IDE, USB, & FireWire Devices
    # ---------------------------------------------------
    my @profile_data = `/usr/sbin/system_profiler SPIDEDataType SPUSBDataType SPFireWireDataType`;
    my $found;
    
    #  Find The First CD/DVD and Eject It
    # ------------------------------------
    foreach (@profile_data) {
    	$found = 1 if /Drive Type.* CD-R/;
    	$found = 0 if ($found && /^\S/);
    	if ($found && /BSD Name.* (disk\S+)/){
    		my $bsd_name=$1; 
    		print "Ejecting $bsd_name\n";
    		system ("/usr/sbin/disktool -e $bsd_name > /dev/null");
    		exit;
    	}
    }
    print "No disk found to eject.\n";
    

    Sorry about the problems there.

    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: ber on Apr 01, '04 11:34:11PM

    No harm at all. Thanks for the update. If I knew how to get mail notification on responses to things I post I'd have checked back here long ago. Appreciate your efforts.

    brian



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: gmachen on Dec 12, '03 10:12:31PM

    > [in] System Profiler ... Not only did the drive appear there
    > under ATA devices, but it also listed the unmounted volume of
    > the disc that was stuck in the drive AND the BSD disk#, which
    > it listed as "disk3". So I fired up Terminal and typed:
    >
    > disktool -e disk3 [Return]
    >
    > My drive magically popped open and I was able to remove the CDROM.

    1) My Jaguar 10.2.6 System Profiler didn't show the BSD disk#. What's up with that?

    2) In any event, if other removable drives are subject to being connected and disconnected across restarts, how does one determine which disk# the CD-ROM drive might land on? I need to know this so I can write a shell script command in an AppleScript applet in the Dock to eject a CD on a Mac without a keyboard or mouse, but with a touchscreen. I need a guaranteed way of knowing which disk# will be the CD-ROM drive.



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: Nash0316 on Aug 21, '04 10:08:16PM

    I, too, have a CD that's stuck. It's Disc #1 out of three Mac OS X Panther Installer discs. I had to reinstall Classic and was using it. When I went to eject it, it disappeared. I've tried each and every hint I've found in here and elsewhere. Nothing works.

    Then I tried your hint and I HAVE found it my the System Profiler ATA! Like yours, it's listed as disk3. I'm afraid, however, that I'm a neophyte on the steps of your hint from there, compared to most peopel who post here who probably know exactly what you're talking about. But I'm desperate.

    If you ever have a minute, I'd really appreciate it if you could try to explain to me exactly, step-by-step, what I need to do. Like, what's toolfix? How do I get to it or how do I get it? And if I can get to it or get it, exactly what would I be doing with it?

    MANY thanks for any help or direction you can give me!

    Riis



    [ Reply to This | # ]
    Wake your Mac with the eject button to eject stubborn discs
    Authored by: mgrif on Mar 10, '04 01:31:03AM

    I have also had problems ejecting disks in my Pioneer 106D when left in the drive for a short period of time, even before my 800MHz eMac to goes to sleep.

    After trying all of the methods outlined above, I came across a hint on the Apple support site at http://docs.info.apple.com/article.html?artnum=51008

    Putting my eMac to sleep via the Apple menu and pressing the eject button to wake it works every time, and is by far the quickest solution I've tried.

    A more serious side effect I've encountered regarding the 106D 'sleep' problem is my computer crashing when booted from Panther Disk 1. If I don't reboot after fixing permissions I have to hold in the power button to restart. The drive likes to spin down after about 20 seconds and if I don't get it to spin up every few minutes I get a black screen. When I try to create a .dmg of my boot volume (5 GB) it also crashes. I have worked around this by using Carbon Copy Cloner but I'd still like to find a real solution.



    [ Reply to This | # ]
    Use Disk Utility to eject unmounted or stuck CDs
    Authored by: jfaughnan on Jul 07, '05 12:29:02AM

    Some PC CDs don't mount in my iBook, probably because they were created using DirectCD and not saved as a standard format. The keyboard eject button doesn't work.

    I fire up Disk Utility. It shows the CD device. I select it and click the eject button. CD comes out.

    ---
    --
    John Faughnan
    jfaughnan@spamcop.net
    www.faughnan.com



    [ Reply to This | # ]
    Might be caused by Parallels
    Authored by: avi4now on Jul 17, '06 08:06:58AM

    If you are using an Intel-based Mac this problem could be caused by Parallels running - it seems to grab the device before OS X can. So if you insert a disk and get nothing cant see it in Finder or Disk Utility check if you have Parallels running. If it is you can probably eject the disk from your virtualized OS then suspend it then reinsert the disk to work with it in OS X.

    (BTW Rob I think theres a bug with the preview function when I used apostrophes or commas all subsequent text was missing. So i had to remove them before posting this. Look Ill put a comma here and then something after it: hello, world.)



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: marxy on Aug 01, '06 04:27:08AM

    I inserted a DVD-R Dual Layer into an intel Mac Mini. It wouldn't eject in any normal way while running so I rebooted...

    The machine wouldn't boot. Tried everything, mouse down, command-option-O-F, F12. It just kept trying to read that disk.

    In the end the solution was to pop the case off the mini, grip the edge of the DVD with needle nosed pliers and start the machine. At a point during the boot it gives up trying to read the disk and ejects it, I had to pull gently with the pliers to get it out.

    The drive seems fine, it reads and ejects CDs just fine, so my conclusion is that it was indeed a software problem and not a physical eject problem.

    There doesn't appear to be any way I could see to eject a disk from these slot load drives.



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: timengler on Aug 16, '06 03:08:12PM

    I have a mac mini and none of this worked for me. The cdrom didn't show up in the Finder, disktool and system_profiler wouldn't show the device name. I tried Eject ME! and Ejector and they both couldn't find the cdrom.

    I finally booted up iTunes, and selected "Eject" from the Controls menu, and it ejected just like that!



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: ptone on Jul 22, '07 04:58:34PM

    check out:

    drutil eject

    -P



    [ Reply to This | # ]
    Use disktool and System Profiler to eject stubborn CDROM discs
    Authored by: morespace54 on Jul 23, '07 10:28:27AM

    Sweeeet! Shortest one...



    [ Reply to This | # ]