eject 中文man页面

系统
Eject 允许可移动介质(典型是 CD-ROM,软盘,磁带,或者 JAZ 以及 ZIP 磁盘) 在软件控制下弹出.该命令也可以控制一些多盘片 CD-ROM 控制器,控制一些设备支持的自动弹出功能,以及控制一些 CD-ROM 驱动器磁盘托盘的关闭.与 name 相应的设备将被弹出.name 可以为设备文件或者其挂载点,也可以为完整路径或者省略前面的 /dev 或者 /mnt 设备文件名.如果没有指定 name,缺省使用 cdrom.有四种不同的弹出的方法,具体要看设备是 CD-ROM, SCSI设备, 可移动软盘, 还是磁带而定.默认的弹出会依次尝试所有四种方法, 直到成功为止. 如果

NAME (名称)

eject - 弹出可移动介质  

SYNOPSIS(总览)

eject -h.breject [-vnrsfq] [<name>]
eject [-vn] -d.breject [-vn] -a on|off|1|0 [<name>]
eject [-vn] -c slot [<name>]
eject [-vn] -t [<name>]  

DESCRIPTION(描述)

Eject 允许可移动介质(典型是 CD-ROM,软盘,磁带,或者 JAZ 以及 ZIP 磁盘) 在软件控制下弹出.该命令也可以控制一些多盘片 CD-ROM 控制器,控制一些设备支持的自动弹出功能,以及控制一些 CD-ROM 驱动器磁盘托盘的关闭.与 name 相应的设备将被弹出.name 可以为设备文件或者其挂载点,也可以为完整路径或者省略前面的 /dev 或者 /mnt 设备文件名.如果没有指定 name,缺省使用 cdrom.有四种不同的弹出的方法,具体要看设备是 CD-ROM, SCSI设备, 可移动软盘, 还是磁带而定.默认的弹出会依次尝试所有四种方法, 直到成功为止. 如果设备当前是挂载上来的, 那么在弹出前要先卸载.

COMMAND-LINE OPTIONS (命令-行选项)

-h
该选项使得 eject 显示关于命令选项的简要描述.
-v
eject 在冗长模式下运行; 显示更多的关于命令作什么用的信息.
-d
如果调用了这个选项, eject 会显示默认的设备名.
-a on|1|off|0
该选项控制一些设备支持的自动弹出模式. 当激活时, 驱动器自动在设备关闭时弹出.
B -c <slot>
有了这个选项, 可由 ATAPI/IDE CD-ROM 控制器选择一个 CD 槽. Linux 2.0 或者更高版本要求使用该功能.CD-ROM 驱动器不能在正使用时 (已挂载数据 CD 或者在播放音乐 CD)响应工作改变请求.还要注意控制器的第一个槽设为 0,而不是 1.
-t
有了这个选项, 会发一个关闭 CD-ROM 托盘的命令给驱动器.不是所有的设备都支持该命令.
-n
有了这个选项, 显示选定的设备, 但是不执行任何动作.
-r
该选项指定了使用 CDROM 弹出命令应被弹出的驱动器.
-s
该选项指定了使用 SCSI 命令应被弹出的驱动器.
-f
该选项指定了使用可移动软盘弹出命令应被弹出的驱动器.
B -q
该选项指定了使用磁带驱动器离线命令应被弹出的驱动器.

LONG OPTIONS(长选项)

所有选项与以下列出的长名字相关. 只要长名字缩写唯一, 它就可以缩写. 

EXAMPLES(示例)

eject

弹出名字为 cdrom 的设备或者挂载点:

eject cdrom

使用设备名来弹出:

eject /dev/cdrom

使用挂载点来弹出:

eject /mnt/cdrom/
eject hdd

弹出第一个 SCSI 设备:

eject sda

使用 SCSI 分区名(例如 ZIP 设备)来弹出 :.IP eject sda4

在多盘片控制器上选择第五个磁盘:

eject -v -c5 /dev/cdrom

在 SoundBlaster CD-ROM 驱动器上开启自动弹出功能:

eject -a on /dev/sdpcd

EXIT STATUS(退出状态)

如果操作成功, 返回 0, 如果操作失败或者命令语法无效, 则返回 1. 

NOTES(备注)

Eject 只对支持四种弹出方式其中之一或更多的设备起作用.这些设备包括大多数的 CD-ROM 驱动器 (IDE, SCSI 和专有接口的),一些 SCSI 磁带驱动器, JAZ 驱动器, ZIP 驱动器(并口, SCSI 以及 IDE 版本接口的),以及 LS120 可移动软盘. 用户已经报告过在 Sun SPARC 和 Apple Macintosh 系统上的软盘驱动器也成功了. 如果 eject 不起作用, 最可能的原因是由于设备的内核驱动的限制, 而并非 eject 程序本身的问题. -r, -s, -f 和 -q 选项可以控制弹出的方式.可指定一种以上的方式. 如果没有指定任何这些选项, 它会尝试所有四种方式(这在多数情况下工作很好). Eject 不一定总是能判断设备是否已经挂载(例如, 如果设备有多个名字).如果设备名是一个符号链接, eject 会跟随该链接并使用其指向的设备.

如果 eject 判断设备能有多个分区, 它会尝试在弹出前卸载所有该设备已挂载的分区.如果卸载失败, 程序不会尝试弹出该介质.

你可以弹出音频 CD.如果驱动器为空, 一些 CD-ROM 驱动器会拒绝打开其托盘. 一些设备不支持托盘关闭的命令. 如果激活了自动弹出的功能.那么驱动器总会在运行该命令后弹出. 不是所有的 Linux 内核 CD-ROM 驱动程序都支持自动弹出模式.

你需要适当的特权以访问设备文件. 在弹出一些设备(例如, SCSI 设备)时,要求以 root 或者 setuid root 的身份运行.

用来找到给定名字的设备的搜索方法如下. 如果名字以标记斜线结束,它将被移去(这是为了支持使用 shell 文件名补全所生成的文件名).如果名字以 '.' 或 '/' 开头, 它会试图以设备文件名或者挂载点打开它.如果那样失败了, 它会尝试在名字前面补加 '/dev/', '/mnt', 直到找到的设备文件名或者能够打开挂载点为止.程序检查 /etc/mtab 以获知已挂载的设备. 如果那样也失败了,它还会检查 /etc/fstab 以获知当前未挂载设备的挂载点.推荐创建如 /dev/cdrom 或者 /dev/zip 之类的符号链接,这样 eject 可以使用易记的名字决定合适的设备. 为了节约输出,你可以创建一个适合于你的特定配置的针对 eject 选项的 shell 别名.  

AUTHOR(作者)

Eject 由 Jeff Tranter (tranter@pobox.com) 写成, 并在 GNU 通用出版许可的条例下发布.参看源文件中的文件 COPYING 和注释以获知详情.  

又见

mount(2), umount(2), mount(8), umount(8) 

#p#

NAME

eject - eject removable media  

SYNOPSIS

eject -h
eject [-vnrsfqp] [<name>]
eject [-vn] -d
eject [-vn] -a on|off|1|0 [<name>]
eject [-vn] -c slot [<name>]
eject [-vn] -t [<name>]
eject [-vn] -x <speed> [<name>]
eject -V

DESCRIPTION

Eject allows removable media (typically a CD-ROM, floppy disk, tape, or JAZ or ZIP disk) to be ejected under software control. The command can also control some multi-disc CD-ROM changers, the auto-eject feature supported by some devices, and close the disc tray of some CD-ROM drives.

The device corresponding to <name> is ejected. The name can be a device file or mount point, either a full path or with the leading "/dev" or "/mnt" omitted. If no name is specified, the default name "cdrom" is used.

There are four different methods of ejecting, depending on whether the device is a CD-ROM, SCSI device, removable floppy, or tape. By default eject tries all four methods in order until it succeeds.

If the device is currently mounted, it is unmounted before ejecting.

COMMAND-LINE OPTIONS

-h
This option causes eject to display a brief description of the command options.
-v
This makes eject run in verbose mode; more information is displayed about what the command is doing.
-d
If invoked with this option, eject lists the default device name.
-a on|1|off|0
This option controls the auto-eject mode, supported by some devices. When enabled, the drive automatically ejects when the device is closed.
-c <slot>
With this option a CD slot can be selected from an ATAPI/IDE CD-ROM changer. Linux 2.0 or higher is required to use this feature. The CD-ROM drive can not be in use (mounted data CD or playing a music CD) for a change request to work. Please also note that the first slot of the changer is referred to as 0, not 1.
-t
With this option the drive is given a CD-ROM tray close command. Not all devices support this command.
-x <speed>
With this option the drive is given a CD-ROM select speed command. The speed argument is a number indicating the desired speed (e.g. 8 for 8X speed), or 0 for maximum data rate. Not all devices support this command and you can only specify speeds that the drive is capable of. Every time the media is changed this option is cleared. This option can be used alone, or with the -t and -c options.
-n
With this option the selected device is displayed but no action is performed.
-r
This option specifies that the drive should be ejected using a CDROM eject command.
-s This option specifies that the drive should be ejected using SCSI commands.
-f
This option specifies that the drive should be ejected using a removable floppy disk eject command.
-q
This option specifies that the drive should be ejected using a tape drive offline command.
-p
This option allow you to use /proc/mounts instead /etc/mtab. It also passes the -n option to umount(1).
-V
This option causes eject to display the program version and exit.

LONG OPTIONS

All options have corresponding long names, as listed below. The long names can be abbreviated as long as they are unique.


-h --help
-v --verbose
-d --default
-a --auto
-c --changerslot
-t --trayclose
-x --cdspeed
-n --noop
-r --cdrom
-s --scsi
-f --floppy
-q --tape
-V --version
-p --proc 

EXAMPLES

Eject the default device:

eject

Eject a device or mount point named cdrom:

eject cdrom

Eject using device name:

eject /dev/cdrom

Eject using mount point:

eject /mnt/cdrom/

Eject 4th IDE device:

eject hdd

Eject first SCSI device:

eject sda

Eject using SCSI partition name (e.g. a ZIP drive):

eject sda4

Select 5th disc on mult-disc changer:

eject -v -c5 /dev/cdrom

Turn on auto-eject on a SoundBlaster CD-ROM drive:

eject -a on /dev/sbpcd

EXIT STATUS

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

NOTES

Eject only works with devices that support one or more of the four methods of ejecting. This includes most CD-ROM drives (IDE, SCSI, and proprietary), some SCSI tape drives, JAZ drives, ZIP drives (parallel port, SCSI, and IDE versions), and LS120 removable floppies. Users have also reported success with floppy drives on Sun SPARC and Apple Macintosh systems. If eject does not work, it is most likely a limitation of the kernel driver for the device and not the eject program itself.

The -r, -s, -f, and -q options allow controlling which methods are used to eject. More than one method can be specified. If none of these options are specified, it tries all four (this works fine in most cases).

Eject may not always be able to determine if the device is mounted (e.g. if it has several names). If the device name is a symbolic link, eject will follow the link and use the device that it points to.

If eject determines that the device can have multiple partitions, it will attempt to unmount all mounted partitions of the device before ejecting. If an unmount fails, the program will not attempt to eject the media.

You can eject an audio CD. Some CD-ROM drives will refuse to open the tray if the drive is empty. Some devices do not support the tray close command.

If the auto-eject feature is enabled, then the drive will always be ejected after running this command. Not all Linux kernel CD-ROM drivers support the auto-eject mode. There is no way to find out the state of the auto-eject mode.

You need appropriate privileges to access the device files. Running as root or setuid root is required to eject some devices (e.g. SCSI devices).

The heuristic used to find a device, given a name, is as follows. If the name ends in a trailing slash, it is removed (this is to support filenames generated using shell file name completion). If the name starts with '.' or '/', it tries to open it as a device file or mount point. If that fails, it tries prepending '/dev/', '/mnt/', '/dev/cdroms', '/dev/rdsk/', '/dev/dsk/', and finally './' to the name, until a device file or mount point is found that can be opened. The program checks /etc/mtab for mounted devices. If that fails, it also checks /etc/fstab for mount points of currently unmounted devices.

Creating symbolic links such as /dev/cdrom or /dev/zip is recommended so that eject can determine the appropriate devices using easily remembered names.

To save typing you can create a shell alias for the eject options that work for your particular setup.

AUTHOR

Eject was written by Jeff Tranter (tranter@pobox.com) and is released under the conditions of the GNU General Public License. See the file COPYING and notes in the source code for details.

The -x option was added by Nobuyuki Tsuchimura (tutimura@nn.iij4u.or.jp), with thanks to Roland Krivanek (krivanek@fmph.uniba.sk) and his cdrom_speed command.

SEE ALSO

mount(2), umount(2), mount(8), umount(8)
/usr/src/linux/Documentation/cdrom/ 

责任编辑:韩亚珊 来源: CMPP.net
相关推荐

2011-08-24 16:48:36

man中文man

2011-08-15 10:21:09

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 15:54:08

ferror中文man

2011-08-25 14:40:27

basename中文man

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man

2011-08-23 15:39:34

rpmbuild中文man
点赞
收藏

51CTO技术栈公众号