1EJECT(1)                         User Commands                        EJECT(1)
2
3
4

NAME

6       eject - eject removable media
7
8       eject [options] device|mountpoint
9

DESCRIPTION

11       eject allows removable media (typically a CD-ROM, floppy disk, tape,
12       JAZ, ZIP or USB disk) to be ejected under software control. The command
13       can also control some multi-disc CD-ROM changers, the auto-eject
14       feature supported by some devices, and close the disc tray of some
15       CD-ROM drives.
16
17       The device corresponding to device or mountpoint is ejected. If no name
18       is specified, the default name /dev/cdrom is used. The device may be
19       addressed by device name (e.g., 'sda'), device path (e.g., '/dev/sda'),
20       UUID=uuid or LABEL=label tags.
21
22       There are four different methods of ejecting, depending on whether the
23       device is a CD-ROM, SCSI device, removable floppy, or tape. By default
24       eject tries all four methods in order until it succeeds.
25
26       If a device partition is specified, the whole-disk device is used.
27
28       If the device or a device partition is currently mounted, it is
29       unmounted before ejecting. The eject is processed on exclusive open
30       block device file descriptor if --no-unmount or --force are not
31       specified.
32

OPTIONS

34       -a, --auto on|off
35           This option controls the auto-eject mode, supported by some
36           devices. When enabled, the drive automatically ejects when the
37           device is closed.
38
39       -c, --changerslot slot
40           With this option a CD slot can be selected from an ATAPI/IDE CD-ROM
41           changer. The CD-ROM drive cannot be in use (mounted data CD or
42           playing a music CD) for a change request to work. Please also note
43           that the first slot of the changer is referred to as 0, not 1.
44
45       -d, --default
46           List the default device name.
47
48       -F, --force
49           Force eject, don’t check device type, don’t open device with
50           exclusive lock. The successful result may be false positive on non
51           hot-pluggable devices.
52
53       -f, --floppy
54           This option specifies that the drive should be ejected using a
55           removable floppy disk eject command.
56
57       -i, --manualeject on|off
58           This option controls locking of the hardware eject button. When
59           enabled, the drive will not be ejected when the button is pressed.
60           This is useful when you are carrying a laptop in a bag or case and
61           don’t want it to eject if the button is inadvertently pressed.
62
63       -M, --no-partitions-unmount
64           The option tells eject to not try to unmount other partitions on
65           partitioned devices. If another partition is still mounted, the
66           program will not attempt to eject the media. It will attempt to
67           unmount only the device or mountpoint given on the command line.
68
69       -m, --no-unmount
70           The option tells eject to not try to unmount at all. If this option
71           is not specified then eject opens the device with O_EXCL flag to be
72           sure that the device is not used (since v2.35).
73
74       -n, --noop
75           With this option the selected device is displayed but no action is
76           performed.
77
78       -p, --proc
79           This option allows you to use /proc/mounts instead /etc/mtab. It
80           also passes the -n option to umount(8).
81
82       -q, --tape
83           This option specifies that the drive should be ejected using a tape
84           drive offline command.
85
86       -r, --cdrom
87           This option specifies that the drive should be ejected using a
88           CDROM eject command.
89
90       -s, --scsi
91           This option specifies that the drive should be ejected using SCSI
92           commands.
93
94       -T, --traytoggle
95           With this option the drive is given a CD-ROM tray close command if
96           it’s opened, and a CD-ROM tray eject command if it’s closed. Not
97           all devices support this command, because it uses the above CD-ROM
98           tray close command.
99
100       -t, --trayclose
101           With this option the drive is given a CD-ROM tray close command.
102           Not all devices support this command.
103
104       -h, --help
105           Display help text and exit.
106
107       -V, --version
108           Print version and exit.
109
110       -v, --verbose
111           Run in verbose mode; more information is displayed about what the
112           command is doing.
113
114       -X, --listspeed
115           With this option the CD-ROM drive will be probed to detect the
116           available speeds. The output is a list of speeds which can be used
117           as an argument of the -x option. This only works with Linux 2.6.13
118           or higher, on previous versions solely the maximum speed will be
119           reported. Also note that some drives may not correctly report the
120           speed and therefore this option does not work with them.
121
122       -x, --cdspeed speed
123           With this option the drive is given a CD-ROM select speed command.
124           The speed argument is a number indicating the desired speed (e.g.,
125           8 for 8X speed), or 0 for maximum data rate. Not all devices
126           support this command and you can only specify speeds that the drive
127           is capable of. Every time the media is changed this option is
128           cleared. This option can be used alone, or with the -t and -c
129           options.
130

EXIT STATUS

132       Returns 0 if operation was successful, 1 if operation failed or command
133       syntax was not valid.
134

NOTES

136       eject only works with devices that support one or more of the four
137       methods of ejecting. This includes most CD-ROM drives (IDE, SCSI, and
138       proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel
139       port, SCSI, and IDE versions), and LS120 removable floppies. Users have
140       also reported success with floppy drives on Sun SPARC and Apple
141       Macintosh systems. If eject does not work, it is most likely a
142       limitation of the kernel driver for the device and not the eject
143       program itself.
144
145       The -r, -s, -f, and -q options allow controlling which methods are used
146       to eject. More than one method can be specified. If none of these
147       options are specified, it tries all four (this works fine in most
148       cases).
149
150       eject may not always be able to determine if the device is mounted
151       (e.g., if it has several names). If the device name is a symbolic link,
152       eject will follow the link and use the device that it points to.
153
154       If eject determines that the device can have multiple partitions, it
155       will attempt to unmount all mounted partitions of the device before
156       ejecting (see also --no-partitions-unmount). If an unmount fails, the
157       program will not attempt to eject the media.
158
159       You can eject an audio CD. Some CD-ROM drives will refuse to open the
160       tray if the drive is empty. Some devices do not support the tray close
161       command.
162
163       If the auto-eject feature is enabled, then the drive will always be
164       ejected after running this command. Not all Linux kernel CD-ROM drivers
165       support the auto-eject mode. There is no way to find out the state of
166       the auto-eject mode.
167
168       You need appropriate privileges to access the device files. Running as
169       root is required to eject some devices (e.g., SCSI devices).
170

AUTHORS

172       Jeff Tranter <tranter@pobox.com> - original author, Karel Zak
173       <kzak@redhat.com> and Michal Luscon <mluscon@redhat.com> - util-linux
174       version.
175

SEE ALSO

177       findmnt(8), lsblk(8), mount(8), umount(8)
178

REPORTING BUGS

180       For bug reports, use the issue tracker at
181       https://github.com/util-linux/util-linux/issues.
182

AVAILABILITY

184       The eject command is part of the util-linux package which can be
185       downloaded from Linux Kernel Archive
186       <https://www.kernel.org/pub/linux/utils/util-linux/>.
187
188
189
190util-linux 2.39.2                 2023-06-14                          EJECT(1)
Impressum