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] -i on|off|1|0 [<name>]
15       eject [-vn] -t [<name>]
16       eject [-vn] -T [<name>]
17       eject [-vn] -x <speed> [<name>]
18       eject [-vn] -X [<name>]
19       eject -V
20
21

DESCRIPTION

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

COMMAND-LINE OPTIONS

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

LONG OPTIONS

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

EXAMPLES

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

EXIT STATUS

198       Returns 0 if operation was successful, 1 if operation failed or command
199       syntax was not valid.
200
201

NOTES

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

AUTHOR

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

SEE ALSO

272       mount(2), umount(2), mount(8), umount(8)
273       /usr/src/linux/Documentation/cdrom/
274
275
276
277Linux                             12 May 2005                         EJECT(1)
Impressum