Using the eject command on CentOS

To eject a CD/DVD tray on a CentOS 7 system, you can use the eject command. With no arguments given to the command on the command line, i.e., a shell prompt, the tray will be ejected. To retract the tray, you can use eject --trayclose or -t. You can use -T or --traytoggle to open the drive, if it is closed or close it, if it is open.

If you specify the -n or --noop option, information on the device will be shown, but no action is taken.

$ eject -n
eject: device is `/dev/sr0'

You can use eject --default to see the default name for the device.

$ eject --default
eject: default device: `/dev/cdrom'

If you need to determine the maximum data transfer speed a CD/DVD drive will support for CDs, you can use the command eject -X or eject --listspeed.

       -X, --listspeed
              With this option the CD-ROM drive will be probed to  detect  the
              available  speeds.   The output is a list of speeds which can be
              used as an argument of the -x  option.   This  only  works  with
              Linux  2.6.13 or higher, on previous versions solely the maximum
              speed will be reported.  Also note that some drive may not  cor‐
              rectly  report the speed and therefore this option does not work
              with them.

This option may not work for all drives. E.g., when I ran the command on a HP desktop system, no information was provided. I.e., I saw the following:

$ eject -X


You may also need to run the command from the root account. On another CentOS 7, system, I saw a "permission denied" error when I used the command until I issued it from the root account.

$ eject -X
eject: cannot open /dev/sr0: Permission denied
$ su - root
Last login: Fri Jul 15 22:06:22 EDT 2016 on pts/1
# eject -X

The number can be translated to a data transfer speed using the table below.

DJI Phantom 3 Drone
Common data transfer speeds for CD-ROM drives
Transfer speed KiB/s Mbit/s MiB/s RPM
150 1.2288 0.146 200–500
300 2.4576 0.293 400-1,000
600 4.9152 0.586 800–2,000
1,200 9.8304 1.17 1,600–4,000
10× 1,500 12.288 1.46 2,000–5,000
12× 1,800 14.7456 1.76 2,400–6,000
20× 1,200–3,000 up to 24.576 up to 2.93 4,000 (CAV)
32× 1,920–4,800 up to 39.3216 up to 4.69 6,400 (CAV)
36× 2,160–5,400 up to 44.2368 up to 5.27 7,200 (CAV)
40× 2,400–6,000 up to 49.152 up to 5.86 8,000 (CAV)
48× 2,880–7,200 up to 58.9824 up to 7.03 9,600 (CAV)
52× 3,120–7,800 up to 63.8976 up to 7.62 10,400 (CAV)
56× 3,360–8,400 up to 68.8128 up to 8.20 11,200 (CAV)
72× 6,750–10,800 up to 88.4736 up to 10.5 2,000 (multi-beam)


TechRabbit ad 300x250

Justdeals Daily Electronics Deals1x1 px