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