]>
Commit | Line | Data |
---|---|---|
312111c2 KZ |
1 | .\" Copyright (C) 1994-2005 Jeff Tranter (tranter@pobox.com) |
2 | .\" Copyright (C) 2012 Karel Zak <kzak@redhat.com> | |
3 | .\" | |
539feec1 ML |
4 | .\" It may be distributed under the GNU Public License, version 2, or |
5 | .\" any higher version. See section COPYING of the GNU Public license | |
6 | .\" for conditions under which this file may be redistributed. | |
312111c2 | 7 | .TH EJECT 1 "April 2012" "Linux" "User Commands" |
539feec1 ML |
8 | .SH NAME |
9 | eject \- eject removable media | |
10 | .SH SYNOPSIS | |
312111c2 KZ |
11 | .B eject |
12 | .RB [ options ] | |
13 | .IR device | mountpoint | |
539feec1 | 14 | .SH DESCRIPTION |
539feec1 | 15 | .B Eject |
312111c2 | 16 | allows removable media (typically a CD-ROM, floppy disk, tape, JAZ, ZIP or USB |
0b66315a | 17 | disk) to be ejected under software control. The command can also control some |
312111c2 KZ |
18 | multi-disc CD-ROM changers, the auto-eject feature supported by some devices, |
19 | and close the disc tray of some CD-ROM drives. | |
0b66315a SK |
20 | .PP |
21 | The device corresponding to \fIdevice\fP or \fImountpoint\fP is ejected. If no | |
28094b1e KZ |
22 | name is specified, the default name /dev/cdrom is used. The device may be |
23 | addressed by device name (e.g. 'sda'), device path (e.g. '/dev/sda'), | |
24 | UUID=<uuid> or LABEL=<label> tags. | |
0b66315a | 25 | .PP |
312111c2 | 26 | There are four different methods of ejecting, depending on whether the device |
0b66315a SK |
27 | is a CD-ROM, SCSI device, removable floppy, or tape. By default eject tries |
28 | all four methods in order until it succeeds. | |
29 | .PP | |
312111c2 KZ |
30 | If device partition is specified, the whole-disk device is used. If the device |
31 | or a device partition is currently mounted, it is unmounted before ejecting. | |
312111c2 KZ |
32 | .SH OPTIONS |
33 | .IP "\fB\-a, \-\-auto \fIon|off\fP" | |
0b66315a | 34 | This option controls the auto-eject mode, supported by some devices. When |
312111c2 KZ |
35 | enabled, the drive automatically ejects when the device is closed. |
36 | .IP "\fB\-c, \-\-changerslot \fIslot\fP" | |
37 | With this option a CD slot can be selected from an ATAPI/IDE CD-ROM changer. | |
38 | Linux 2.0 or higher is required to use this feature. The CD-ROM drive can not | |
39 | be in use (mounted data CD or playing a music CD) for a change request to work. | |
40 | Please also note that the first slot of the changer is referred to as 0, not 1. | |
41 | .IP "\fB\-d, \-\-default\fP" | |
42 | List the default device name. | |
43 | .IP "\fB\-f, \-\-floppy\fP" | |
44 | This option specifies that the drive should be ejected using a removable floppy | |
45 | disk eject command. | |
46 | .IP "\fB\-F, \-\-force\fP" | |
8bb4a6cb | 47 | Force eject, don't check device type. |
312111c2 KZ |
48 | .IP "\fB\-h, \-\-help\fP" |
49 | Print a help text and exit. | |
50 | .IP "\fB\-i, \-\-manualeject \fIon|off\fP" | |
0b66315a | 51 | This option controls locking of the hardware eject button. When enabled, the |
312111c2 KZ |
52 | drive will not be ejected when the button is pressed. This is useful when you |
53 | are carrying a laptop in a bag or case and don't want it to eject if the button | |
54 | is inadvertently pressed. | |
55 | .IP "\fB\-p, \-\-proc\fP" | |
56 | This option allow you to use /proc/mounts instead /etc/mtab. It also passes the | |
8323d9fd | 57 | \-n option to \fBumount\fR(1). |
312111c2 KZ |
58 | .IP "\fB\-q, \-\-tape\fP" |
59 | This option specifies that the drive should be ejected using a tape drive | |
60 | offline command. | |
61 | .IP "\fB\-m, \-\-no-unmount\fP" | |
566cd92c KZ |
62 | The option tells eject to not try to unmount at all. |
63 | .IP "\fB\-M, \-\-no-partitions-unmount\fP" | |
64 | The option tells eject to not try to unmount another partitions on partitioned | |
65 | devices. If another partition is mounted the program will not attempt to eject | |
66 | the media. It will attempt to unmount only mountpoint or mounted device given | |
67 | on eject command line. | |
312111c2 KZ |
68 | .IP "\fB\-n, \-\-noop\fP" |
69 | With this option the selected device is displayed but no action is performed. | |
70 | .IP "\fB\-t, \-\-trayclose\fP" | |
0b66315a | 71 | With this option the drive is given a CD-ROM tray close command. Not all |
312111c2 KZ |
72 | devices support this command. |
73 | .IP "\fB\-T, \-\-traytoggle\fP" | |
74 | With this option the drive is given a CD-ROM tray close command if it's opened, | |
0b66315a | 75 | and a CD-ROM tray eject command if it's closed. Not all devices support this |
312111c2 KZ |
76 | command, because it uses the above CD-ROM tray close command. |
77 | .IP "\fB\-r, \-\-cdrom\fP" | |
78 | This option specifies that the drive should be ejected using a CDROM eject | |
79 | command. | |
80 | .IP "\fB\-s, \-\-scsi\fP" | |
81 | This option specifies that the drive should be ejected using SCSI commands. | |
312111c2 KZ |
82 | .IP "\fB\-v, \-\-verbose\fP" |
83 | Run in verbose mode; more information is displayed about what the command is | |
84 | doing. | |
85 | .IP "\fB\-V, \-\-version\fP" | |
86 | Display program version and exit. | |
87 | .IP "\fB\-x, \-\-cdspeed \fI<speed>\fP" | |
88 | With this option the drive is given a CD-ROM select speed command. The speed | |
89 | argument is a number indicating the desired speed (e.g. 8 for 8X speed), or 0 | |
0b66315a SK |
90 | for maximum data rate. Not all devices support this command and you can only |
91 | specify speeds that the drive is capable of. Every time the media is changed | |
92 | this option is cleared. This option can be used alone, or with the \-t and \-c | |
312111c2 KZ |
93 | options. |
94 | .IP "\fB\-X, \-\-listspeed\fP" | |
95 | With this option the CD-ROM drive will be probed to detect the available | |
0b66315a SK |
96 | speeds. The output is a list of speeds which can be used as an argument of the |
97 | \-x option. This only works with Linux 2.6.13 or higher, on previous versions | |
98 | solely the maximum speed will be reported. Also note that some drive may not | |
312111c2 | 99 | correctly report the speed and therefore this option does not work with them. |
539feec1 | 100 | .SH EXIT STATUS |
312111c2 KZ |
101 | Returns 0 if operation was successful, 1 if operation failed or command syntax |
102 | was not valid. | |
539feec1 | 103 | .SH NOTES |
539feec1 | 104 | .B Eject |
312111c2 | 105 | only works with devices that support one or more of the four methods of |
0b66315a | 106 | ejecting. This includes most CD-ROM drives (IDE, SCSI, and proprietary), some |
312111c2 | 107 | SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE |
0b66315a SK |
108 | versions), and LS120 removable floppies. Users have also reported success with |
109 | floppy drives on Sun SPARC and Apple Macintosh systems. If | |
539feec1 | 110 | .B eject |
312111c2 KZ |
111 | does not work, it is most likely a limitation of the kernel driver for the |
112 | device and not the | |
539feec1 ML |
113 | .B eject |
114 | program itself. | |
0b66315a | 115 | .PP |
312111c2 | 116 | The \-r, \-s, \-f, and \-q options allow controlling which methods are used to |
0b66315a | 117 | eject. More than one method can be specified. If none of these options are |
312111c2 | 118 | specified, it tries all four (this works fine in most cases). |
0b66315a | 119 | .PP |
539feec1 | 120 | .B Eject |
312111c2 | 121 | may not always be able to determine if the device is mounted (e.g. if it has |
0b66315a | 122 | several names). If the device name is a symbolic link, |
539feec1 ML |
123 | .B eject |
124 | will follow the link and use the device that it points to. | |
0b66315a | 125 | .PP |
539feec1 ML |
126 | If |
127 | .B eject | |
312111c2 | 128 | determines that the device can have multiple partitions, it will attempt to |
566cd92c KZ |
129 | unmount all mounted partitions of the device before ejecting (see |
130 | --no-partitions-unmount). If an unmount fails, the program will not attempt to | |
131 | eject the media. | |
0b66315a SK |
132 | .PP |
133 | You can eject an audio CD. Some CD-ROM drives will refuse to open the tray if | |
134 | the drive is empty. Some devices do not support the tray close command. | |
135 | .PP | |
312111c2 | 136 | If the auto-eject feature is enabled, then the drive will always be ejected |
0b66315a SK |
137 | after running this command. Not all Linux kernel CD-ROM drivers support the |
138 | auto-eject mode. There is no way to find out the state of the auto-eject mode. | |
139 | .PP | |
140 | You need appropriate privileges to access the device files. Running as root is | |
312111c2 | 141 | required to eject some devices (e.g. SCSI devices). |
312111c2 | 142 | .SH AUTHORS |
0b66315a SK |
143 | .MT tranter@\:pobox.com |
144 | Jeff Tranter | |
145 | .ME | |
146 | - original author. | |
147 | .br | |
148 | .MT kzak@\:redhat.com | |
149 | Karel Zak | |
150 | .ME | |
151 | and | |
152 | .MT mluscon@\:redhat.com | |
153 | Michal Luscon | |
154 | .ME | |
155 | - util-linux version. | |
539feec1 | 156 | .SH SEE ALSO |
312111c2 KZ |
157 | .BR lsblk (8), |
158 | .BR findmnt (8), | |
159 | .BR mount (8), | |
160 | .BR umount (8) | |
161 | .SH AVAILABILITY | |
0b66315a SK |
162 | The eject command is part of the util-linux package and is available from |
163 | .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ | |
164 | Linux Kernel Archive | |
165 | .UE . |