]> git.ipfire.org Git - thirdparty/util-linux.git/blame - sys-utils/eject.1
cfdisk: reenable cursor when quitting
[thirdparty/util-linux.git] / sys-utils / eject.1
CommitLineData
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
9eject \- 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 16allows removable media (typically a CD-ROM, floppy disk, tape, JAZ, ZIP or USB
0b66315a 17disk) to be ejected under software control. The command can also control some
312111c2
KZ
18multi-disc CD-ROM changers, the auto-eject feature supported by some devices,
19and close the disc tray of some CD-ROM drives.
0b66315a
SK
20.PP
21The device corresponding to \fIdevice\fP or \fImountpoint\fP is ejected. If no
e33ee284 22name is specified, the default name \fB/dev/cdrom\fR is used. The device may be
28094b1e 23addressed by device name (e.g. 'sda'), device path (e.g. '/dev/sda'),
e33ee284 24UUID=\fIuuid\fR or LABEL=\fIlabel\fR tags.
0b66315a 25.PP
312111c2 26There are four different methods of ejecting, depending on whether the device
e33ee284 27is a CD-ROM, SCSI device, removable floppy, or tape. By default \fBeject\fR tries
0b66315a
SK
28all four methods in order until it succeeds.
29.PP
e33ee284 30If a device partition is specified, the whole-disk device is used. If the device
312111c2 31or 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 34This option controls the auto-eject mode, supported by some devices. When
312111c2
KZ
35enabled, the drive automatically ejects when the device is closed.
36.IP "\fB\-c, \-\-changerslot \fIslot\fP"
37With this option a CD slot can be selected from an ATAPI/IDE CD-ROM changer.
e33ee284 38Linux 2.0 or higher is required to use this feature. The CD-ROM drive cannot
312111c2
KZ
39be in use (mounted data CD or playing a music CD) for a change request to work.
40Please also note that the first slot of the changer is referred to as 0, not 1.
41.IP "\fB\-d, \-\-default\fP"
42List the default device name.
43.IP "\fB\-f, \-\-floppy\fP"
44This option specifies that the drive should be ejected using a removable floppy
45disk eject command.
46.IP "\fB\-F, \-\-force\fP"
8bb4a6cb 47Force eject, don't check device type.
312111c2 48.IP "\fB\-h, \-\-help\fP"
b4362b6f 49Display help text and exit.
e33ee284 50.IP "\fB\-i\fR, \fB\-\-manualeject on\fR|\fBoff\fR"
0b66315a 51This option controls locking of the hardware eject button. When enabled, the
312111c2
KZ
52drive will not be ejected when the button is pressed. This is useful when you
53are carrying a laptop in a bag or case and don't want it to eject if the button
54is inadvertently pressed.
55.IP "\fB\-p, \-\-proc\fP"
e33ee284
BS
56This 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"
59This option specifies that the drive should be ejected using a tape drive
60offline command.
61.IP "\fB\-m, \-\-no-unmount\fP"
566cd92c
KZ
62The option tells eject to not try to unmount at all.
63.IP "\fB\-M, \-\-no-partitions-unmount\fP"
e33ee284
BS
64The option tells eject to not try to unmount other partitions on partitioned
65devices. If another partition is still mounted, the program will not attempt
66to eject the media. It will attempt to unmount only the device or mountpoint
67given on the command line.
312111c2
KZ
68.IP "\fB\-n, \-\-noop\fP"
69With this option the selected device is displayed but no action is performed.
70.IP "\fB\-t, \-\-trayclose\fP"
0b66315a 71With this option the drive is given a CD-ROM tray close command. Not all
312111c2
KZ
72devices support this command.
73.IP "\fB\-T, \-\-traytoggle\fP"
74With this option the drive is given a CD-ROM tray close command if it's opened,
0b66315a 75and a CD-ROM tray eject command if it's closed. Not all devices support this
312111c2
KZ
76command, because it uses the above CD-ROM tray close command.
77.IP "\fB\-r, \-\-cdrom\fP"
78This option specifies that the drive should be ejected using a CDROM eject
79command.
80.IP "\fB\-s, \-\-scsi\fP"
81This option specifies that the drive should be ejected using SCSI commands.
312111c2
KZ
82.IP "\fB\-v, \-\-verbose\fP"
83Run in verbose mode; more information is displayed about what the command is
84doing.
85.IP "\fB\-V, \-\-version\fP"
b4362b6f 86Display version information and exit.
e33ee284
BS
87.IP "\fB\-x, \-\-cdspeed \fIspeed\fP"
88With this option the drive is given a CD-ROM select speed command. The
89.I speed
312111c2 90argument is a number indicating the desired speed (e.g. 8 for 8X speed), or 0
0b66315a
SK
91for maximum data rate. Not all devices support this command and you can only
92specify speeds that the drive is capable of. Every time the media is changed
e33ee284
BS
93this 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"
96With this option the CD-ROM drive will be probed to detect the available
0b66315a 97speeds. 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
99solely the maximum speed will be reported. Also note that some drives may not
312111c2 100correctly report the speed and therefore this option does not work with them.
539feec1 101.SH EXIT STATUS
312111c2
KZ
102Returns 0 if operation was successful, 1 if operation failed or command syntax
103was not valid.
539feec1 104.SH NOTES
e33ee284 105.B eject
312111c2 106only works with devices that support one or more of the four methods of
0b66315a 107ejecting. This includes most CD-ROM drives (IDE, SCSI, and proprietary), some
312111c2 108SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE
0b66315a
SK
109versions), and LS120 removable floppies. Users have also reported success with
110floppy drives on Sun SPARC and Apple Macintosh systems. If
539feec1 111.B eject
312111c2
KZ
112does not work, it is most likely a limitation of the kernel driver for the
113device and not the
539feec1
ML
114.B eject
115program itself.
0b66315a 116.PP
e33ee284
BS
117The \fB\-r\fR, \fB\-s\fR, \fB\-f\fR, and \fB\-q\fR options allow controlling
118which methods are used to
0b66315a 119eject. More than one method can be specified. If none of these options are
312111c2 120specified, it tries all four (this works fine in most cases).
0b66315a 121.PP
e33ee284 122.B eject
312111c2 123may not always be able to determine if the device is mounted (e.g. if it has
0b66315a 124several names). If the device name is a symbolic link,
539feec1
ML
125.B eject
126will follow the link and use the device that it points to.
0b66315a 127.PP
539feec1
ML
128If
129.B eject
312111c2 130determines that the device can have multiple partitions, it will attempt to
e33ee284
BS
131unmount all mounted partitions of the device before ejecting (see also
132\fB--no-partitions-unmount\fR). If an unmount fails, the program will not
133attempt to eject the media.
0b66315a
SK
134.PP
135You can eject an audio CD. Some CD-ROM drives will refuse to open the tray if
136the drive is empty. Some devices do not support the tray close command.
137.PP
312111c2 138If the auto-eject feature is enabled, then the drive will always be ejected
0b66315a
SK
139after running this command. Not all Linux kernel CD-ROM drivers support the
140auto-eject mode. There is no way to find out the state of the auto-eject mode.
141.PP
142You need appropriate privileges to access the device files. Running as root is
312111c2 143required to eject some devices (e.g. SCSI devices).
312111c2 144.SH AUTHORS
0b66315a
SK
145.MT tranter@\:pobox.com
146Jeff Tranter
147.ME
148- original author.
149.br
150.MT kzak@\:redhat.com
151Karel Zak
152.ME
153and
154.MT mluscon@\:redhat.com
155Michal 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
164The eject command is part of the util-linux package and is available from
165.UR ftp://\:ftp.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
166Linux Kernel Archive
167.UE .