]>
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 | 11 | .B eject |
e33ee284 | 12 | [options] |
312111c2 | 13 | .IR device | mountpoint |
539feec1 | 14 | .SH DESCRIPTION |
e33ee284 | 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 | |
e33ee284 | 22 | name is specified, the default name \fB/dev/cdrom\fR is used. The device may be |
28094b1e | 23 | addressed by device name (e.g. 'sda'), device path (e.g. '/dev/sda'), |
e33ee284 | 24 | UUID=\fIuuid\fR or LABEL=\fIlabel\fR tags. |
0b66315a | 25 | .PP |
312111c2 | 26 | There are four different methods of ejecting, depending on whether the device |
e33ee284 | 27 | is a CD-ROM, SCSI device, removable floppy, or tape. By default \fBeject\fR tries |
0b66315a SK |
28 | all four methods in order until it succeeds. |
29 | .PP | |
e33ee284 | 30 | If a device partition is specified, the whole-disk device is used. If the device |
312111c2 | 31 | or a device partition is currently mounted, it is unmounted before ejecting. |
312111c2 | 32 | .SH OPTIONS |
e33ee284 | 33 | .IP "\fB\-a\fR, \fB\-\-auto on\fR|\fBoff\fR" |
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. | |
e33ee284 | 38 | Linux 2.0 or higher is required to use this feature. The CD-ROM drive cannot |
312111c2 KZ |
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 | 48 | .IP "\fB\-h, \-\-help\fP" |
b4362b6f | 49 | Display help text and exit. |
e33ee284 | 50 | .IP "\fB\-i\fR, \fB\-\-manualeject on\fR|\fBoff\fR" |
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" | |
e33ee284 BS |
56 | This option allows you to use /proc/mounts instead /etc/mtab. It also passes the |
57 | \fB\-n\fR 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" | |
e33ee284 BS |
64 | The option tells eject to not try to unmount other partitions on partitioned |
65 | devices. If another partition is still mounted, the program will not attempt | |
66 | to eject the media. It will attempt to unmount only the device or mountpoint | |
67 | given on the 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" | |
b4362b6f | 86 | Display version information and exit. |
e33ee284 BS |
87 | .IP "\fB\-x, \-\-cdspeed \fIspeed\fP" |
88 | With this option the drive is given a CD-ROM select speed command. The | |
89 | .I speed | |
312111c2 | 90 | argument is a number indicating the desired speed (e.g. 8 for 8X speed), or 0 |
0b66315a SK |
91 | for maximum data rate. Not all devices support this command and you can only |
92 | specify speeds that the drive is capable of. Every time the media is changed | |
e33ee284 BS |
93 | this option is cleared. This option can be used alone, or with the |
94 | \fB\-t\fR and \fB\-c\fR options. | |
312111c2 KZ |
95 | .IP "\fB\-X, \-\-listspeed\fP" |
96 | With this option the CD-ROM drive will be probed to detect the available | |
0b66315a | 97 | speeds. The output is a list of speeds which can be used as an argument of the |
e33ee284 BS |
98 | \fB\-x\fR option. This only works with Linux 2.6.13 or higher, on previous versions |
99 | solely the maximum speed will be reported. Also note that some drives may not | |
312111c2 | 100 | correctly report the speed and therefore this option does not work with them. |
539feec1 | 101 | .SH EXIT STATUS |
312111c2 KZ |
102 | Returns 0 if operation was successful, 1 if operation failed or command syntax |
103 | was not valid. | |
539feec1 | 104 | .SH NOTES |
e33ee284 | 105 | .B eject |
312111c2 | 106 | only works with devices that support one or more of the four methods of |
0b66315a | 107 | ejecting. This includes most CD-ROM drives (IDE, SCSI, and proprietary), some |
312111c2 | 108 | SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE |
0b66315a SK |
109 | versions), and LS120 removable floppies. Users have also reported success with |
110 | floppy drives on Sun SPARC and Apple Macintosh systems. If | |
539feec1 | 111 | .B eject |
312111c2 KZ |
112 | does not work, it is most likely a limitation of the kernel driver for the |
113 | device and not the | |
539feec1 ML |
114 | .B eject |
115 | program itself. | |
0b66315a | 116 | .PP |
e33ee284 BS |
117 | The \fB\-r\fR, \fB\-s\fR, \fB\-f\fR, and \fB\-q\fR options allow controlling |
118 | which methods are used to | |
0b66315a | 119 | eject. More than one method can be specified. If none of these options are |
312111c2 | 120 | specified, it tries all four (this works fine in most cases). |
0b66315a | 121 | .PP |
e33ee284 | 122 | .B eject |
312111c2 | 123 | may not always be able to determine if the device is mounted (e.g. if it has |
0b66315a | 124 | several names). If the device name is a symbolic link, |
539feec1 ML |
125 | .B eject |
126 | will follow the link and use the device that it points to. | |
0b66315a | 127 | .PP |
539feec1 ML |
128 | If |
129 | .B eject | |
312111c2 | 130 | determines that the device can have multiple partitions, it will attempt to |
e33ee284 BS |
131 | unmount all mounted partitions of the device before ejecting (see also |
132 | \fB--no-partitions-unmount\fR). If an unmount fails, the program will not | |
133 | attempt to eject the media. | |
0b66315a SK |
134 | .PP |
135 | You can eject an audio CD. Some CD-ROM drives will refuse to open the tray if | |
136 | the drive is empty. Some devices do not support the tray close command. | |
137 | .PP | |
312111c2 | 138 | If the auto-eject feature is enabled, then the drive will always be ejected |
0b66315a SK |
139 | after running this command. Not all Linux kernel CD-ROM drivers support the |
140 | auto-eject mode. There is no way to find out the state of the auto-eject mode. | |
141 | .PP | |
142 | You need appropriate privileges to access the device files. Running as root is | |
312111c2 | 143 | required to eject some devices (e.g. SCSI devices). |
312111c2 | 144 | .SH AUTHORS |
0b66315a SK |
145 | .MT tranter@\:pobox.com |
146 | Jeff Tranter | |
147 | .ME | |
148 | - original author. | |
149 | .br | |
150 | .MT kzak@\:redhat.com | |
151 | Karel Zak | |
152 | .ME | |
153 | and | |
154 | .MT mluscon@\:redhat.com | |
155 | Michal Luscon | |
156 | .ME | |
157 | - util-linux version. | |
539feec1 | 158 | .SH SEE ALSO |
312111c2 KZ |
159 | .BR lsblk (8), |
160 | .BR findmnt (8), | |
161 | .BR mount (8), | |
162 | .BR umount (8) | |
163 | .SH AVAILABILITY | |
0b66315a SK |
164 | The eject command is part of the util-linux package and is available from |
165 | .UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/ | |
166 | Linux Kernel Archive | |
167 | .UE . |