Copyright (c) 2009, Sun Microsystems, Inc.
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.
See the License for the specific language governing permissions and limitations under the License. When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with
the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
eject [-dflqt] [ [device | nickname]]
The eject utility is used for those removable media devices that do not have a manual eject button, or for those that might be locked due to, for instance, being mounted. The device may be specified by its name or by a nickname. If no device is specified, the default device is used.
Only devices that support eject under program control respond to this command.
When eject is used on media that can only be ejected manually, it does everything except remove the media, including unmounting the file system if it is mounted. In this case, eject displays a message that the media can now be manually ejected.
Do not physically eject media from a device that contains mounted file systems. eject automatically searches for any mounted file systems that reside on the device, and attempts to umount them prior to ejecting the media. See mount(1M). If the unmount operation fails, eject prints a warning message and exits. The -f option can be used to specify an eject even if the device contains mounted partitions.
If you have inserted a floppy diskette, you might need to use volcheck(1) before ejecting the media to inform the system the floppy's presence.
Pressing the physical media eject button located on some drives' front panel has the same effect as invoking eject for the respective drive. Not all drives have this capability.
The following options are supported: -d
Display the name of the default device to be ejected.
Force the device to eject even if it is busy.
Display paths and nicknames of ejectable devices.
Query to see if the media is present.
Issues the drive a CD-ROM tray close command. Not all devices support this command.
The following operands are supported: device
Specifies which device to eject, by the name it appears in the directory /dev.
Specifies which device to eject, by its nickname as known to this command. Volume label or device type (for example, cdrom or floppy0) can be used as a nickname.
Example 1 Ejecting Media
The following example ejects media by its volume label:
example> eject 'My Pictures'
Example 2 Ejecting a Floppy Disk
The following example ejects a floppy disk from the first floppy drive:
example> eject floppy0
The following exit codes are returned: 0
The operation was successful or, with the -q option, the media is in the drive.
The operation was unsuccessful or, with the -q option, the media is not in the drive.
Invalid options were specified.
An ioctl() request failed.
Manually ejectable media is now okay to remove.
default diskette file
default CD-ROM file (deprecated)
volcheck(1), mount(1M), rmmount(1M), ioctl(2), attributes(5)