eject 中文man頁面
NAME (名稱)
eject - 彈出可移動(dòng)介質(zhì)
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 允許可移動(dòng)介質(zhì)(典型是 CD-ROM,軟盤,磁帶,或者 JAZ 以及 ZIP 磁盤) 在軟件控制下彈出.該命令也可以控制一些多盤片 CD-ROM 控制器,控制一些設(shè)備支持的自動(dòng)彈出功能,以及控制一些 CD-ROM 驅(qū)動(dòng)器磁盤托盤的關(guān)閉.與 name 相應(yīng)的設(shè)備將被彈出.name 可以為設(shè)備文件或者其掛載點(diǎn),也可以為完整路徑或者省略前面的 /dev 或者 /mnt 設(shè)備文件名.如果沒有指定 name,缺省使用 cdrom.有四種不同的彈出的方法,具體要看設(shè)備是 CD-ROM, SCSI設(shè)備, 可移動(dòng)軟盤, 還是磁帶而定.默認(rèn)的彈出會(huì)依次嘗試所有四種方法, 直到成功為止. 如果設(shè)備當(dāng)前是掛載上來的, 那么在彈出前要先卸載.
COMMAND-LINE OPTIONS (命令-行選項(xiàng))
- -h
- 該選項(xiàng)使得 eject 顯示關(guān)于命令選項(xiàng)的簡(jiǎn)要描述.
- -v
- 令 eject 在冗長(zhǎng)模式下運(yùn)行; 顯示更多的關(guān)于命令作什么用的信息.
- -d
- 如果調(diào)用了這個(gè)選項(xiàng), eject 會(huì)顯示默認(rèn)的設(shè)備名.
- -a on|1|off|0
- 該選項(xiàng)控制一些設(shè)備支持的自動(dòng)彈出模式. 當(dāng)激活時(shí), 驅(qū)動(dòng)器自動(dòng)在設(shè)備關(guān)閉時(shí)彈出.
- B -c <slot>
- 有了這個(gè)選項(xiàng), 可由 ATAPI/IDE CD-ROM 控制器選擇一個(gè) CD 槽. Linux 2.0 或者更高版本要求使用該功能.CD-ROM 驅(qū)動(dòng)器不能在正使用時(shí) (已掛載數(shù)據(jù) CD 或者在播放音樂 CD)響應(yīng)工作改變請(qǐng)求.還要注意控制器的第一個(gè)槽設(shè)為 0,而不是 1.
- -t
- 有了這個(gè)選項(xiàng), 會(huì)發(fā)一個(gè)關(guān)閉 CD-ROM 托盤的命令給驅(qū)動(dòng)器.不是所有的設(shè)備都支持該命令.
- -n
- 有了這個(gè)選項(xiàng), 顯示選定的設(shè)備, 但是不執(zhí)行任何動(dòng)作.
- -r
- 該選項(xiàng)指定了使用 CDROM 彈出命令應(yīng)被彈出的驅(qū)動(dòng)器.
- -s
- 該選項(xiàng)指定了使用 SCSI 命令應(yīng)被彈出的驅(qū)動(dòng)器.
- -f
- 該選項(xiàng)指定了使用可移動(dòng)軟盤彈出命令應(yīng)被彈出的驅(qū)動(dòng)器.
- B -q
- 該選項(xiàng)指定了使用磁帶驅(qū)動(dòng)器離線命令應(yīng)被彈出的驅(qū)動(dòng)器.
LONG OPTIONS(長(zhǎng)選項(xiàng))
所有選項(xiàng)與以下列出的長(zhǎng)名字相關(guān). 只要長(zhǎng)名字縮寫唯一, 它就可以縮寫.
EXAMPLES(示例)
- eject
彈出名字為 cdrom 的設(shè)備或者掛載點(diǎn):
- eject cdrom
使用設(shè)備名來彈出:
- eject /dev/cdrom
使用掛載點(diǎn)來彈出:
- eject /mnt/cdrom/
- eject hdd
彈出第一個(gè) SCSI 設(shè)備:
- eject sda
使用 SCSI 分區(qū)名(例如 ZIP 設(shè)備)來彈出 :.IP eject sda4
在多盤片控制器上選擇第五個(gè)磁盤:
- eject -v -c5 /dev/cdrom
在 SoundBlaster CD-ROM 驅(qū)動(dòng)器上開啟自動(dòng)彈出功能:
- eject -a on /dev/sdpcd
EXIT STATUS(退出狀態(tài))
如果操作成功, 返回 0, 如果操作失敗或者命令語法無效, 則返回 1.
NOTES(備注)
Eject 只對(duì)支持四種彈出方式其中之一或更多的設(shè)備起作用.這些設(shè)備包括大多數(shù)的 CD-ROM 驅(qū)動(dòng)器 (IDE, SCSI 和專有接口的),一些 SCSI 磁帶驅(qū)動(dòng)器, JAZ 驅(qū)動(dòng)器, ZIP 驅(qū)動(dòng)器(并口, SCSI 以及 IDE 版本接口的),以及 LS120 可移動(dòng)軟盤. 用戶已經(jīng)報(bào)告過在 Sun SPARC 和 Apple Macintosh 系統(tǒng)上的軟盤驅(qū)動(dòng)器也成功了. 如果 eject 不起作用, 最可能的原因是由于設(shè)備的內(nèi)核驅(qū)動(dòng)的限制, 而并非 eject 程序本身的問題. -r, -s, -f 和 -q 選項(xiàng)可以控制彈出的方式.可指定一種以上的方式. 如果沒有指定任何這些選項(xiàng), 它會(huì)嘗試所有四種方式(這在多數(shù)情況下工作很好). Eject 不一定總是能判斷設(shè)備是否已經(jīng)掛載(例如, 如果設(shè)備有多個(gè)名字).如果設(shè)備名是一個(gè)符號(hào)鏈接, eject 會(huì)跟隨該鏈接并使用其指向的設(shè)備.
如果 eject 判斷設(shè)備能有多個(gè)分區(qū), 它會(huì)嘗試在彈出前卸載所有該設(shè)備已掛載的分區(qū).如果卸載失敗, 程序不會(huì)嘗試彈出該介質(zhì).
你可以彈出音頻 CD.如果驅(qū)動(dòng)器為空, 一些 CD-ROM 驅(qū)動(dòng)器會(huì)拒絕打開其托盤. 一些設(shè)備不支持托盤關(guān)閉的命令. 如果激活了自動(dòng)彈出的功能.那么驅(qū)動(dòng)器總會(huì)在運(yùn)行該命令后彈出. 不是所有的 Linux 內(nèi)核 CD-ROM 驅(qū)動(dòng)程序都支持自動(dòng)彈出模式.
你需要適當(dāng)?shù)奶貦?quán)以訪問設(shè)備文件. 在彈出一些設(shè)備(例如, SCSI 設(shè)備)時(shí),要求以 root 或者 setuid root 的身份運(yùn)行.
用來找到給定名字的設(shè)備的搜索方法如下. 如果名字以標(biāo)記斜線結(jié)束,它將被移去(這是為了支持使用 shell 文件名補(bǔ)全所生成的文件名).如果名字以 '.' 或 '/' 開頭, 它會(huì)試圖以設(shè)備文件名或者掛載點(diǎn)打開它.如果那樣失敗了, 它會(huì)嘗試在名字前面補(bǔ)加 '/dev/', '/mnt', 直到找到的設(shè)備文件名或者能夠打開掛載點(diǎn)為止.程序檢查 /etc/mtab 以獲知已掛載的設(shè)備. 如果那樣也失敗了,它還會(huì)檢查 /etc/fstab 以獲知當(dāng)前未掛載設(shè)備的掛載點(diǎn).推薦創(chuàng)建如 /dev/cdrom 或者 /dev/zip 之類的符號(hào)鏈接,這樣 eject 可以使用易記的名字決定合適的設(shè)備. 為了節(jié)約輸出,你可以創(chuàng)建一個(gè)適合于你的特定配置的針對(duì) eject 選項(xiàng)的 shell 別名.
AUTHOR(作者)
Eject 由 Jeff Tranter (tranter@pobox.com) 寫成, 并在 GNU 通用出版許可的條例下發(fā)布.參看源文件中的文件 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/