1EJECT(1)                         User Commands                        EJECT(1)
2
3
4

NAME

6       eject - eject removable media
7

SYNOPSIS

9       eject -h
10       eject [-vnrsfmqp] [<name>]
11       eject [-vn] -d
12       eject [-vn] -a on|off|1|0 [<name>]
13       eject [-vn] -c slot [<name>]
14       eject [-vn] -t [<name>]
15       eject [-vn] -T [<name>]
16       eject [-vn] -x <speed> [<name>]
17       eject [-vn] -X [<name>]
18       eject -V
19
20

DESCRIPTION

22       Eject allows removable media (typically a CD-ROM, floppy disk, tape, or
23       JAZ or ZIP disk) to be ejected under software control. The command  can
24       also  control  some  multi-disc CD-ROM changers, the auto-eject feature
25       supported by some devices, and close  the  disc  tray  of  some  CD-ROM
26       drives.
27
28       The device corresponding to <name> is ejected. The name can be a device
29       file or mount point, either a full path or  with  the  leading  "/dev",
30       "/media"  or  "/mnt" omitted. If no name is specified, the default name
31       "cdrom" is used.
32
33       There are four different methods of ejecting, depending on whether  the
34       device  is a CD-ROM, SCSI device, removable floppy, or tape. By default
35       eject tries all four methods in order until it succeeds.
36
37       If the device is currently mounted, it is unmounted before ejecting.
38
39

COMMAND-LINE OPTIONS

41       -h   This option causes eject to display a  brief  description  of  the
42            command options.
43
44
45       -v   This  makes  eject  run  in verbose mode; more information is dis‐
46            played about what the command is doing.
47
48
49       -d   If invoked with this option, eject lists the default device name.
50
51
52       -a on|1|off|0
53            This option  controls  the  auto-eject  mode,  supported  by  some
54            devices.   When  enabled,  the drive automatically ejects when the
55            device is closed.
56
57
58       -c <slot>
59            With this option a CD slot can be selected from an  ATAPI/IDE  CD-
60            ROM  changer. Linux 2.0 or higher is required to use this feature.
61            The CD-ROM drive can not be in use (mounted data CD or  playing  a
62            music  CD) for a change request to work. Please also note that the
63            first slot of the changer is referred to as 0, not 1.
64
65
66       -t   With this option the drive is given a CD-ROM tray  close  command.
67            Not all devices support this command.
68
69
70       -T   With this option the drive is given a CD-ROM tray close command if
71            it's opened, and a CD-ROM tray eject command if it's  closed.  Not
72            all devices support this command, because it uses the above CD-ROM
73            tray close command.
74
75
76       -x <speed>
77            With this option the drive is given a CD-ROM select speed command.
78            The  speed argument is a number indicating the desired speed (e.g.
79            8 for 8X speed), or 0 for maximum data rate. Not all devices  sup‐
80            port  this  command and you can only specify speeds that the drive
81            is capable of. Every time the media  is  changed  this  option  is
82            cleared.  This  option  can  be  used alone, or with the -t and -c
83            options.
84
85
86       -X   With this option the CD-ROM drive will be  probed  to  detect  the
87            available speeds. The output is a list of speeds which can be used
88            as an argument of the -x option. This only works with Linux 2.6.13
89            or  higher,  on previous versions solely the maximum speed will be
90            reported. Also note that some drive may not correctly  report  the
91            speed and therefore this option does not work with them.
92
93
94       -n   With this option the selected device is displayed but no action is
95            performed.
96
97
98       -r   This option specifies that the drive should  be  ejected  using  a
99            CDROM eject command.
100
101
102       -s   This  option specifies that the drive should be ejected using SCSI
103            commands.
104
105
106       -f   This option specifies that the drive should  be  ejected  using  a
107            removable floppy disk eject command.
108
109
110       -q   This  option  specifies  that  the drive should be ejected using a
111            tape drive offline command.
112
113
114       -p   This option allow you to use /proc/mounts  instead  /etc/mtab.  It
115            also passes the -n option to umount(1).
116
117
118       -m   This  option  allows eject to work with device drivers which auto‐
119            matically mount removable  media  and  therefore  must  be  always
120            mount()ed.  The option tells eject to not try to unmount the given
121            device,  even  if  it  is  mounted  according  to   /etc/mtab   or
122            /proc/mounts.
123
124
125       -V   This option causes eject to display the program version and exit.
126
127

LONG OPTIONS

129       All  options  have  corresponding long names, as listed below. The long
130       names can be abbreviated as long as they are unique.
131
132       -h --help
133       -v --verbose
134       -d --default
135       -a --auto
136       -c --changerslot
137       -t --trayclose
138       -T --traytoggle
139       -x --cdspeed
140       -X --listspeed
141       -n --noop
142       -r --cdrom
143       -s --scsi
144       -f --floppy
145       -q --tape
146       -V --version
147       -p --proc
148       -m --no-unmount
149
150

EXAMPLES

152       Eject the default device:
153
154              eject
155
156       Eject a device or mount point named cdrom:
157
158              eject cdrom
159
160       Eject using device name:
161
162              eject /dev/cdrom
163
164       Eject using mount point:
165
166              eject /mnt/cdrom/
167
168       Eject 4th IDE device:
169
170              eject hdd
171
172       Eject first SCSI device:
173
174              eject sda
175
176       Eject using SCSI partition name (e.g. a ZIP drive):
177
178              eject sda4
179
180       Select 5th disc on multi-disc changer:
181
182              eject -v -c4 /dev/cdrom
183
184       Turn on auto-eject on a SoundBlaster CD-ROM drive:
185
186              eject -a on /dev/sbpcd
187
188

EXIT STATUS

190       Returns 0 if operation was successful, 1 if operation failed or command
191       syntax was not valid.
192
193

NOTES

195       Eject  only  works  with  devices  that support one or more of the four
196       methods of ejecting. This includes most CD-ROM drives (IDE,  SCSI,  and
197       proprietary),  some  SCSI tape drives, JAZ drives, ZIP drives (parallel
198       port, SCSI, and IDE versions), and LS120 removable floppies. Users have
199       also  reported success with floppy drives on Sun SPARC and Apple Macin‐
200       tosh systems. If eject does not work, it is most likely a limitation of
201       the kernel driver for the device and not the eject program itself.
202
203       The -r, -s, -f, and -q options allow controlling which methods are used
204       to eject. More than one method can  be  specified.  If  none  of  these
205       options  are  specified,  it  tries  all  four (this works fine in most
206       cases).
207
208       Eject may not always be able to determine  if  the  device  is  mounted
209       (e.g.  if it has several names). If the device name is a symbolic link,
210       eject will follow the link and use the device that it points to.
211
212       If eject determines that the device can have  multiple  partitions,  it
213       will  attempt  to  unmount  all mounted partitions of the device before
214       ejecting. If an unmount fails, the program will not  attempt  to  eject
215       the media.
216
217       You  can  eject an audio CD. Some CD-ROM drives will refuse to open the
218       tray if the drive is empty. Some devices do not support the tray  close
219       command.
220
221       If  the  auto-eject  feature  is enabled, then the drive will always be
222       ejected after running this command. Not all Linux kernel CD-ROM drivers
223       support  the  auto-eject mode. There is no way to find out the state of
224       the auto-eject mode.
225
226       You need appropriate privileges to access the device files. Running  as
227       root  or  setuid  root  is  required  to  eject some devices (e.g. SCSI
228       devices).
229
230       The heuristic used to find a device, given a name, is  as  follows.  If
231       the  name  ends  in a trailing slash, it is removed (this is to support
232       filenames generated using shell file  name  completion).  If  the  name
233       starts  with  '.' or '/', it tries to open it as a device file or mount
234       point. If that fails, it tries prepending '/dev/', '/media/'  ,'/mnt/',
235       '/dev/cdroms', '/dev/rdsk/', '/dev/dsk/', and finally './' to the name,
236       until a device file or mount point is found that  can  be  opened.  The
237       program  checks  /etc/mtab  for mounted devices. If that fails, it also
238       checks /etc/fstab for mount points of currently unmounted devices.
239
240       Creating symbolic links such as /dev/cdrom or /dev/zip  is  recommended
241       so that eject can determine the appropriate devices using easily remem‐
242       bered names.
243
244       To save typing you can create a shell alias for the eject options  that
245       work for your particular setup.
246
247

AUTHOR

249       Eject  was  written by Jeff Tranter (tranter@pobox.com) and is released
250       under the conditions of the GNU General Public License.  See  the  file
251       COPYING and notes in the source code for details.
252
253       The     -x     option     was     added    by    Nobuyuki    Tsuchimura
254       (tutimura@nn.iij4u.or.jp),  with  thanks  to  Roland   Krivanek   (kri‐
255       vanek@fmph.uniba.sk) and his cdrom_speed command.
256
257       The  -T option was added by Sybren Stuvel (sybren@thirdtower.com), with
258       big thanks to Benjamin Schwenk (benjaminschwenk@yahoo.de).
259
260       The -X option was added by Eric Piel (Eric.Piel@tremplin-utc.net).
261
262

SEE ALSO

264       mount(2), umount(2), mount(8), umount(8)
265       /usr/src/linux/Documentation/cdrom/
266
267
268
269Linux                             12 May 2005                         EJECT(1)
Impressum