1 .\" This file Copyright (C) 1994-2005 Jeff Tranter
2 .\" (tranter@pobox.com)
3 .\" It may be distributed under the GNU Public License, version 2, or
4 .\" any higher version. See section COPYING of the GNU Public license
5 .\" for conditions under which this file may be redistributed.
6 .TH EJECT 1 "12 May 2005" "Linux" "User Commands"
8 eject \- eject removable media
12 eject [\-vnrsfmqp] [<name>]
16 eject [\-vn] \-a on|off|1|0 [<name>]
18 eject [\-vn] \-c slot [<name>]
20 eject [\-vn] \-t [<name>]
22 eject [\-vn] \-T [<name>]
24 eject [\-vn] \-x <speed> [<name>]
26 eject [\-vn] \-X [<name>]
33 allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ
34 or ZIP disk) to be ejected under software control. The command can
35 also control some multi-disc CD-ROM changers, the auto-eject feature
36 supported by some devices, and close the disc tray of some CD-ROM
39 The device corresponding to <name> is ejected. The name can be a
40 device file or mount point, either a full path or with the leading
41 "/dev", "/media" or "/mnt" omitted. If no name is specified, the default name
44 There are four different methods of ejecting, depending on whether the
45 device is a CD-ROM, SCSI device, removable floppy, or tape. By default
46 eject tries all four methods in order until it succeeds.
48 If the device is currently mounted, it is unmounted before ejecting.
51 .SH "COMMAND\-LINE OPTIONS"
56 to display a brief description of the command options.
62 run in verbose mode; more information is displayed about what the
67 If invoked with this option,
69 lists the default device name.
73 This option controls the auto-eject mode, supported by some devices.
74 When enabled, the drive automatically ejects when the device is
79 With this option a CD slot can be selected from an ATAPI/IDE CD-ROM
80 changer. Linux 2.0 or higher is required to use this feature. The
81 CD-ROM drive can not be in use (mounted data CD or playing a music CD)
82 for a change request to work. Please also note that the first slot of
83 the changer is referred to as 0, not 1.
87 With this option the drive is given a CD-ROM tray close command. Not
88 all devices support this command.
92 With this option the drive is given a CD-ROM tray close command if
93 it's opened, and a CD-ROM tray eject command if it's closed. Not all
94 devices support this command, because it uses the above CD-ROM tray
99 With this option the drive is given a CD-ROM select speed command.
100 The speed argument is a number indicating the desired speed (e.g. 8
101 for 8X speed), or 0 for maximum data rate. Not all devices support
102 this command and you can only specify speeds that the drive is capable
103 of. Every time the media is changed this option is cleared. This
104 option can be used alone, or with the \-t and \-c options.
108 With this option the CD-ROM drive will be probed to detect the
109 available speeds. The output is a list of speeds which can be used as
110 an argument of the \-x option. This only works with Linux 2.6.13 or
111 higher, on previous versions solely the maximum speed will be
112 reported. Also note that some drive may not correctly report the speed
113 and therefore this option does not work with them.
117 With this option the selected device is displayed but no action is
122 This option specifies that the drive should be ejected using a
127 This option specifies that the drive should be ejected using
132 This option specifies that the drive should be ejected using a
133 removable floppy disk eject command.
137 This option specifies that the drive should be ejected using a
138 tape drive offline command.
142 This option allow you to use /proc/mounts instead /etc/mtab. It
143 also passes the \-n option to umount(1).
147 This option allows eject to work with device drivers which automatically
148 mount removable media and therefore must be always mount()ed.
149 The option tells eject to not try to unmount the given device,
150 even if it is mounted according to /etc/mtab or /proc/mounts.
156 to display the program version and exit.
159 All options have corresponding long names, as listed below. The long
160 names can be abbreviated as long as they are unique.
200 Eject the default device:
204 Eject a device or mount point named cdrom:
208 Eject using device name:
212 Eject using mount point:
216 Eject 4th IDE device:
220 Eject first SCSI device:
224 Eject using SCSI partition name (e.g. a ZIP drive):
228 Select 5th disc on multi-disc changer:
230 eject \-v \-c4 /dev/cdrom
232 Turn on auto-eject on a SoundBlaster CD-ROM drive:
234 eject \-a on /dev/sbpcd
239 Returns 0 if operation was successful, 1 if operation failed or command
240 syntax was not valid.
246 only works with devices that support one or more of the four methods
247 of ejecting. This includes most CD-ROM drives (IDE, SCSI, and
248 proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel
249 port, SCSI, and IDE versions), and LS120 removable floppies. Users
250 have also reported success with floppy drives on Sun SPARC and Apple
251 Macintosh systems. If
253 does not work, it is most likely a limitation of the kernel driver
254 for the device and not the
258 The \-r, \-s, \-f, and \-q options allow controlling which methods are
259 used to eject. More than one method can be specified. If none of these
260 options are specified, it tries all four (this works fine in most
264 may not always be able to determine if the device is mounted (e.g. if
265 it has several names). If the device name is a symbolic link,
267 will follow the link and use the device that it points to.
271 determines that the device can have multiple partitions, it will
272 attempt to unmount all mounted partitions of the device before
273 ejecting. If an unmount fails, the program will not attempt to eject
276 You can eject an audio CD. Some CD-ROM drives will refuse to open the
277 tray if the drive is empty. Some devices do not support the tray close
280 If the auto-eject feature is enabled, then the drive will always be
281 ejected after running this command. Not all Linux kernel CD-ROM
282 drivers support the auto-eject mode. There is no way to find out the
283 state of the auto-eject mode.
285 You need appropriate privileges to access the device files. Running as
286 root or setuid root is required to eject some devices (e.g. SCSI
289 The heuristic used to find a device, given a name, is as follows. If
290 the name ends in a trailing slash, it is removed (this is to support
291 filenames generated using shell file name completion). If the name
292 starts with '.' or '/', it tries to open it as a device file or mount
293 point. If that fails, it tries prepending '/dev/', '/media/' ,'/mnt/',
294 \&'/dev/cdroms', '/dev/rdsk/', '/dev/dsk/', and finally './' to the name,
296 device file or mount point is found that can be opened. The program
297 checks /etc/mtab for mounted devices. If that fails, it also checks
298 /etc/fstab for mount points of currently unmounted devices.
300 Creating symbolic links such as /dev/cdrom or /dev/zip is recommended
303 can determine the appropriate devices using easily remembered names.
305 To save typing you can create a shell alias for the eject options that
306 work for your particular setup.
310 was written by Jeff Tranter (tranter@pobox.com) and is released
311 under the conditions of the GNU General Public License. See the file
312 COPYING and notes in the source code for details.
314 The \-x option was added by Nobuyuki Tsuchimura (tutimura@nn.iij4u.or.jp),
315 with thanks to Roland Krivanek (krivanek@fmph.uniba.sk) and his
318 The \-T option was added by Sybren Stuvel (sybren@thirdtower.com), with
319 big thanks to Benjamin Schwenk (benjaminschwenk@yahoo.de).
321 The \-X option was added by Eric Piel (Eric.Piel@tremplin-utc.net).
325 mount(2), umount(2), mount(8), umount(8)
327 /usr/src/linux/Documentation/cdrom/