Imported upstream version 1.5
[manpages-zh.git] / raw / man1 / eject.1
blob93f59b83f0500a207594dec1eb0f06f242d3d67e
1 .\" This file Copyright (C) 1994-2001 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 "18 May 2001" "Linux" "User Commands"
7 .SH NAME
8 eject \- eject removable media
9 .SH SYNOPSIS
10 eject -h
11 .br
12 eject [-vnrsfqp] [<name>]
13 .br
14 eject [-vn] -d
15 .br
16 eject [-vn] -a on|off|1|0 [<name>]
17 .br
18 eject [-vn] -c slot [<name>]
19 .br
20 eject [-vn] -t [<name>]
21 .br
22 eject [-vn] -x <speed> [<name>]
23 .br
24 eject -V
26 .SH DESCRIPTION
28 .B Eject
29 allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ
30 or ZIP disk) to be ejected under software control. The command can
31 also control some multi-disc CD-ROM changers, the auto-eject feature
32 supported by some devices, and close the disc tray of some CD-ROM
33 drives.
35 The device corresponding to <name> is ejected. The name can be a
36 device file or mount point, either a full path or with the leading
37 "/dev" or "/mnt" omitted. If no name is specified, the default name
38 "cdrom" is used.
40 There are four different methods of ejecting, depending on whether the
41 device is a CD-ROM, SCSI device, removable floppy, or tape. By default
42 eject tries all four methods in order until it succeeds.
44 If the device is currently mounted, it is unmounted before ejecting.
46 .PP
47 .SH "COMMAND\-LINE OPTIONS"
48 .TP 0.5i
49 .B -h
50 This option causes
51 .B eject
52 to display a brief description of the command options.
54 .TP 0.5i
55 .B -v
56 This makes
57 .B eject
58 run in verbose mode; more information is displayed about what the
59 command is doing.
61 .TP 0.5i
62 .B -d
63 If invoked with this option,
64 .B eject
65 lists the default device name.
67 .TP 0.5i
68 .B -a on|1|off|0
69 This option controls the auto-eject mode, supported by some devices.
70 When enabled, the drive automatically ejects when the device is
71 closed.
73 .TP 0.5i
74 .B -c <slot>
75 With this option a CD slot can be selected from an ATAPI/IDE CD-ROM
76 changer. Linux 2.0 or higher is required to use this feature. The
77 CD-ROM drive can not be in use (mounted data CD or playing a music CD)
78 for a change request to work. Please also note that the first slot of
79 the changer is referred to as 0, not 1.
81 .TP 0.5i
82 .B -t
83 With this option the drive is given a CD-ROM tray close command. Not
84 all devices support this command.
86 .TP 0.5i
87 .B -x <speed>
88 With this option the drive is given a CD-ROM select speed command.
89 The speed argument is a number indicating the desired speed (e.g. 8
90 for 8X speed), or 0 for maximum data rate. Not all devices support
91 this command and you can only specify speeds that the drive is capable
92 of. Every time the media is changed this option is cleared. This
93 option can be used alone, or with the -t and -c options.
95 .TP 0.5i
96 .B -n
97 With this option the selected device is displayed but no action is
98 performed.
100 .TP 0.5i
101 .B -r
102 This option specifies that the drive should be ejected using a
103 CDROM eject command.
104 .TP 0.5i
106 .B -s
107 This option specifies that the drive should be ejected using
108 SCSI commands.
110 .TP 0.5i
111 .B -f
112 This option specifies that the drive should be ejected using a
113 removable floppy disk eject command.
115 .TP 0.5i
116 .B -q
117 This option specifies that the drive should be ejected using a
118 tape drive offline command.
120 .TP 0.5i
121 .B -p
122 This option allow you to use /proc/mounts instead /etc/mtab. It
123 also passes the -n option to umount(1).
125 .TP 0.5i
126 .B -V
127 This option causes
128 .B eject
129 to display the program version and exit.
131 .SH LONG OPTIONS
132 All options have corresponding long names, as listed below. The long
133 names can be abbreviated as long as they are unique.
136 -h --help
138 -v --verbose
140 -d --default
142 -a --auto
144 -c --changerslot
146 -t --trayclose
148 -x --cdspeed
150 -n --noop
152 -r --cdrom
154 -s --scsi
156 -f --floppy
158 -q --tape
160 -V --version
162 -p --proc
165 .SH EXAMPLES
167 Eject the default device:
169 eject
171 Eject a device or mount point named cdrom:
173 eject cdrom
175 Eject using device name:
177 eject /dev/cdrom
179 Eject using mount point:
181 eject /mnt/cdrom/
183 Eject 4th IDE device:
185 eject hdd
187 Eject first SCSI device:
189 eject sda
191 Eject using SCSI partition name (e.g. a ZIP drive):
193 eject sda4
195 Select 5th disc on mult-disc changer:
197 eject -v -c5 /dev/cdrom
199 Turn on auto-eject on a SoundBlaster CD-ROM drive:
201 eject -a on /dev/sbpcd
203 .SH EXIT STATUS
206 Returns 0 if operation was successful, 1 if operation failed or command
207 syntax was not valid.
209 .SH NOTES
212 .B Eject
213 only works with devices that support one or more of the four methods
214 of ejecting. This includes most CD-ROM drives (IDE, SCSI, and
215 proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel
216 port, SCSI, and IDE versions), and LS120 removable floppies. Users
217 have also reported success with floppy drives on Sun SPARC and Apple
218 Macintosh systems. If
219 .B eject
220 does not work, it is most likely a limitation of the kernel driver
221 for the device and not the
222 .B eject
223 program itself.
225 The -r, -s, -f, and -q options allow controlling which methods are
226 used to eject. More than one method can be specified. If none of these
227 options are specified, it tries all four (this works fine in most
228 cases).
230 .B Eject
231 may not always be able to determine if the device is mounted (e.g. if
232 it has several names). If the device name is a symbolic link,
233 .B eject
234 will follow the link and use the device that it points to.
237 .B eject
238 determines that the device can have multiple partitions, it will
239 attempt to unmount all mounted partitions of the device before
240 ejecting. If an unmount fails, the program will not attempt to eject
241 the media.
243 You can eject an audio CD. Some CD-ROM drives will refuse to open the
244 tray if the drive is empty. Some devices do not support the tray close
245 command.
247 If the auto-eject feature is enabled, then the drive will always be
248 ejected after running this command. Not all Linux kernel CD-ROM
249 drivers support the auto-eject mode. There is no way to find out the
250 state of the auto-eject mode.
252 You need appropriate privileges to access the device files. Running as
253 root or setuid root is required to eject some devices (e.g. SCSI
254 devices).
256 The heuristic used to find a device, given a name, is as follows. If
257 the name ends in a trailing slash, it is removed (this is to support
258 filenames generated using shell file name completion). If the name
259 starts with '.' or '/', it tries to open it as a device file or mount
260 point. If that fails, it tries prepending '/dev/', '/mnt/', '/dev/cdroms',
261 \&'/dev/rdsk/', '/dev/dsk/', and finally './' to the name, until a
262 device file or mount point is found that can be opened. The program
263 checks /etc/mtab for mounted devices. If that fails, it also checks
264 /etc/fstab for mount points of currently unmounted devices.
266 Creating symbolic links such as /dev/cdrom or /dev/zip is recommended
267 so that
268 .B eject
269 can determine the appropriate devices using easily remembered names.
271 To save typing you can create a shell alias for the eject options that
272 work for your particular setup.
274 .SH AUTHOR
275 .B Eject
276 was written by Jeff Tranter (tranter@pobox.com) and is released
277 under the conditions of the GNU General Public License. See the file
278 COPYING and notes in the source code for details.
280 The -x option was added by Nobuyuki Tsuchimura (tutimura@nn.iij4u.or.jp),
281 with thanks to Roland Krivanek (krivanek@fmph.uniba.sk) and his
282 cdrom_speed command.
284 .SH SEE ALSO
286 mount(2), umount(2), mount(8), umount(8)
288 /usr/src/linux/Documentation/cdrom/