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

NAME

6       eject - eject removable media
7

SYNOPSIS

9       eject [options] device|mountpoint
10

DESCRIPTION

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 a 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

OPTIONS

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

EXIT STATUS

129       Returns 0 if operation was successful, 1 if operation failed or command
130       syntax was not valid.
131

NOTES

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

AUTHORS

169       Jeff Tranter ⟨tranter@pobox.com⟩ - original author.
170       Karel Zak ⟨kzak@redhat.com⟩ and Michal  Luscon  ⟨mluscon@redhat.com⟩  -
171       util-linux version.
172

SEE ALSO

174       findmnt(8), lsblk(8), mount(8), umount(8)
175

AVAILABILITY

177       The  eject  command  is part of the util-linux package and is available
178       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
179       linux/⟩.
180
181
182
183Linux                             April 2012                          EJECT(1)
Impressum