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.
28
29       If the device or  a  device  partition  is  currently  mounted,  it  is
30       unmounted  before  ejecting.   The eject is processed on exclusive open
31       block device file descriptor if --no-unmount or --force are not  speci‐
32       fied.
33
34

OPTIONS

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

EXIT STATUS

137       Returns 0 if operation was successful, 1 if operation failed or command
138       syntax was not valid.
139

NOTES

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

AUTHORS

177       Jeff Tranter ⟨tranter@pobox.com⟩ - original author.
178       Karel  Zak  ⟨kzak@redhat.com⟩  and Michal Luscon ⟨mluscon@redhat.com⟩ -
179       util-linux version.
180

SEE ALSO

182       findmnt(8), lsblk(8), mount(8), umount(8)
183

AVAILABILITY

185       The eject command is part of the util-linux package  and  is  available
186       from Linux Kernel Archive ⟨https://www.kernel.org/pub/linux/utils/util-
187       linux/⟩.
188
189
190
191Linux                             April 2012                          EJECT(1)
Impressum