Simpler Navigation for Servers and Operating Systems - Please Update Your Bookmarks
Completed: a much simpler Servers and Operating Systems section of the Community. We combined many of the older boards, so you won't have to click through so many levels to get at the information you need. Check the consolidated boards here as many sub-forums are now single boards.
If you have bookmarked forums or discussion boards in Servers and Operating Systems, we suggest you check and update them as needed.
Showing results for 
Search instead for 
Did you mean: 

Ejecting CD-ROM

System Dude_1
Frequent Advisor

Ejecting CD-ROM

Could anyone send me a c script to eject cdrom from the drive
Performance Issue on HP-UX 10.20
John Carr_2
Honored Contributor

Re: Ejecting CD-ROM


unfortunatly unlike Solaris which has an eject command I have never seen this in hpux. I hope you get a program or command to do it .

S.K. Chan
Honored Contributor

Re: Ejecting CD-ROM

You can, just have to umount it and press the button. There is a previuos thread that you can look at ..,,0xb59d0559ff7cd4118fef0090279cd0f9,00.html
Kurt Beyers.
Honored Contributor

Re: Ejecting CD-ROM

I don't think that an eject command exists on HP-UX as it does on Linux.

You can dismount the cdrom as follows. Find first the device file of the cdrom:
ioscan -funC disk

Then dismount it:
umount /dev/dsk/c3t2d0 (use your device file)

Make sure that no one is in the directory where the cdrom is mounted. You could kill those sessions with the command:

fuser -ku /dev/dsk/c3t2d0

You can combine these 2 commands easily in a shell script.

Justo Exposito
Esteemed Contributor

Re: Ejecting CD-ROM


Only a note:

Beware, if you mount a CD with the "mount" command use "umount" to unmount the CD, but if you mount the CD with the "pfs_mount" command unmount it with pfs_umount. If not you go into troubles with your CD.

I think that there is not an eject command in HP/UX too. You must push the button.


Help is a Beatiful word
Brian K. Arnholt
Frequent Advisor

Re: Ejecting CD-ROM

To add on to Justo's response, be very careful if you use the pfs_mount command to mount the CD-ROM, be sure to un-mount it with the corresponding "pfs_umount" command. If you inadvertently use "umount", things get ugly (I know from personal experience!). If this happens, you can attempt to kill the pfs daemons and try to eject the CD-ROM, but in some cases, a reboot is necessary to correct the problem (if at all possible, stay away from pfs_mount commands).

Following are steps to use if you do use the pfs_mount option:
1.Insert cdrom into drive

2.start processes Pfs:
#/usr/sbin/pfs_mountd &
#/usr/sbin/pfsd &
3.Note: verify > #ps -ef | grep pfs

4.find cdrom device name (ioscan -funC disk) [e.g. /dev/dsk/c1t2d0]
5.validate mount point to mount cdrom [e.g. /cdrom]

6.#pfs_mount /dev/dsk/c1t2d0 /cdrom

To umount do the following:
1.#pfs_umount /cdrom
2. manually eject cdrom from drive. (press eject button)
3.#kill processess [pfsd and pfs_mountd]

Some see things as they are and ask why, I dream of things that never were and ask why not?
David Burgess
Esteemed Contributor

Re: Ejecting CD-ROM

What you need is an apprentice / trainee to push the button for you ;-)

Jeff Schussele
Honored Contributor

Re: Ejecting CD-ROM

Maybe if we all requested, HP can add this request for an eject command to the list for future HP-UX version(s)!
Sure is handy in Solaris.
HP folks, are you listening?

PERSEVERANCE -- Remember, whatever does not kill you only makes you stronger!
Heiner E. Lennackers
Respected Contributor

Re: Ejecting CD-ROM


please take a look to thread,,0xb59d0559ff7cd4118fef0090279cd0f9,00.html

There has someone posted a c-source to eject a (scsi)cdrom. i haven't tested it, but maybe it helps.

"If this makes any sense to you, you have a big problem."
if this makes any sense to you, you have a BIG problem