ejectのヘルプ・マニュアル
日本語 英語
eject --help
man eject
EJECT(1) User Commands EJECT(1)
名前
eject - リムーバブルメディアをイジェクトする
書式
eject -h
eject [-vnrsfmqp] []
eject [-vn] -d
eject [-vn] -a on|off|1|0 []
eject [-vn] -c slot []
eject [-vn] -t []
eject [-vn] -T []
eject [-vn] -x []
eject [-vn] -X []
eject -V
説明
eject を用いると、リムーバブルメディア (CD-ROM、フロッピーディスク、テ
ープ、 JAZ/ZIP ディスクなど) をソフトウェア制御によってイジェクトできる
。また eject は、連装 CD-ROM チェンジャを制御したり、デバイスの自動イジ
ェクト機能を制御したり、CD-ROM ドライブのディスクトレイを閉じることもで
きる (製品によってはできないこともある)。
引 き数 に対応するデバイスがイジェクトされる。 name はデバイスフ
ァイルまたはマウントポイントであり、フ ル パ ス で も 先 頭 の "/dev",
"/media", "/mnt" を省略した形でもどちらでもよい。 name が指定されない場
合、デフォルトでは "cdrom" が対象となる。
対象デバイスが CD-ROM、SCSI デバイス、リムーバブルフロッピー、テープ で
あるかによって、4 つの異なるイジェクト方法がある。デフォルトでは、eject
は 4 つの方法全てを成功するまで順に試行する。
対象デバイスがマウントされている場合、イジェクト前にアンマウントされ る
。
コマンド行オプション
-h このオプションは、 eject にコマンドオプションの簡単な説明を表示さ
せる。
-v eject を詳細表示モードで実行する; eject が実行していることについて
、より多くの情報が表示される。
-d このオプションとともに実行すると、 eject はデフォルトのデバイス名
を表示する。
-a on|1|off|0
このオプションは、いくつかのデバイスでサポートされている自動イジェ
クトモードを制御する。自動イジェクトモードを有効にすると、対象デバ
イスがクローズされたときにそのドライブは自動的にイジェクトする。
-c
このオプションにより、ATAPI/IDE CD-ROM チェンジャの CD スロット を
選択できる。この機能を利用するには、Linux 2.0 以上が必要である。ス
ロット切替要求が機能するためには、 CD-ROM ドライブが動作中 (データ
CD をマウントしていたり、音楽 CD を演奏していたり) であってはなら
ない。チェンジャの最初のスロットが、 1 ではなく 0 で参照される点に
ついても注意してほしい。
-t このオプションは、ドライブに CD-ROM トレイのクローズコマンドを与え
る。全てのデバイスがこのコマンドをサポートするわけではない。
-T このオプションは、CD-ROM トレイがオープンしている場合には、クロ ー
ズコマンドを与える。また CD-ROM トレイがクローズしている場合には、
イジェクトコマンドを与える。このオプションは上記の CD-ROM トレイの
クローズコマンドを使うので、全てのデバイスでこのコマンドがサポート
されている訳ではない。
-x
このオプションはドライブに CD-ROM スピード選択コマンドを与え る 。
speed 引き数は希望するスピード (たとえば 8 倍速の場合は 8) を表す
数字である。最大データレートにする場合は 0 にする。全てのデバイ ス
がこのコマンドをサポートしているわけではないので、これをサポートし
ているデバイスにのみ指定できる。メディアを交換するたびに、このオプ
シ ョ ンはクリアされる。このオプションは単独で使用するか、-t と -c
オプションとともに使用する。
-X このオプションは CD-ROM ドライブで利用可能なスピードを調べる。出力
は スピードのリストで、-x オプションの引き数として指定可能である。
このオプションは Linux 2.6.13 以降でのみ動作し、それ以前のバージョ
ンでは単に最大スピードだけが返される。スピードを正確に返さないドラ
イブもあり、そのようなドライブでは、このオプションが動作しない点に
注意すること。
-n このオプションは選択されたデバイスを表示するが、何の操作も行わない
。
-r このオプションは、CDROM イジェクトコマンドを用いて対象ドライブをイ
ジェクトするよう指定する。
-s このオプションは、SCSI コマンドを用いて対象ドライブをイジェクトす
るよう指定する。
-f このオプションは、リムーバブルフロッピーディスクイジェクトコマンド
を用いて対象ドライブをイジェクトするよう指定する。
-q このオプションは、テープドライブオフラインコマンドを用いて対象ドラ
イブをイジェクトするよう指定する。
-p このオプションを指定すると、 /etc/mtab ではなく /proc/mounts を 使
う ことができる。このオプションは umount(1) に -n オプションを渡す
。
-m このオプションを指定すると、リムーバブルメディアを自動的にマウント
す るデバイスドライバと共に eject を使用することができる。そのため
リムーバブルメディアに対して常に mount() が実行される。指定され た
デ バイスが /etc/mtab または /proc/mounts に基づいてマウントされて
いても、このオプションは eject にアンマウントを行わせない。
-V このオプションを使うと、 eject はプログラムのバージョンを表示し て
終了する。
長いオプション
以 下に示すように、全てのオプションには対応する長い名前がある。これらは
、一意に識別できる長さまで省略することができる。
-h --help
-v --verbose
-d --default
-a --auto
-c --changerslot
-t --trayclose
-T --traytoggle
-x --cdspeed
-X --listspeed
-n --noop
-r --cdrom
-s --scsi
-f --floppy
-q --tape
-V --version
-p --proc
-m --no-unmount
例
デフォルトのデバイスをイジェクトする:
eject
cdrom という名前のデバイスまたはマウントポイントをイジェクトする:
eject cdrom
デバイス名でイジェクトする:
eject /dev/cdrom
マウントポイントでイジェクトする:
eject /mnt/cdrom/
4 番目の IDE デバイスをイジェクトする:
eject hdd
1 番目の SCSI デバイスをイジェクトする:
eject sda
SCSI パーティション名 (例えば、ZIP ドライブ) でイジェクトする:
eject sda4
連装チェンジャの 5 番目のディスクを選択する:
eject -v -c4 /dev/cdrom
SoundBlaster CD-ROM ドライブの自動イジェクトを有効にする:
eject -a on /dev/sbpcd
返り値
操作が成功すると 0 を返す。操作が失敗、またはコマンドの構文が間違ってい
ると 1 を返す。
注意
eject は、4 つのイジェクト方法のうち 1 つ以上をサポートするデバイスに対
してのみ有効である。これには、ほとんどの CD-ROM ドライブ (IDE、SCSI、独
自 規格)、何種類かの SCSI テープドライブ、JAZ ドライブ、 ZIP ドライブ (
パラレルポート版、SCSI 版、IDE 版)、 LS120 リムーバブルフロッピーが含ま
れ る。 Sun SPARC と Apple Macintosh のフロッピードライブについても、ユ
ーザーからの成功報告がある。 eject が動作しないのは、ほとんどの場合、そ
のデバイスのカーネルドライバの制限によるものであり、 eject プログラム自
体の制限ではない。
-r, -s, -f, -q オプションで、どのイジェクト方法を用いるかを制御できる。
複 数のイジェクト方法を指定することができる。これらのオプションが全く指
定されないと、eject は 4 つの方法全てを試行する (これはほとんどの場合に
上手く動作する)。
eject は、対象デバイスがマウントされているかどうかを常に判断できるわけ
ではない (例えば、そのデバイスに複数の名前がある場合)。デバイス名がシン
ボリックリンクである場合、 eject はリンクを辿り、リンク先のデバイスを使
用する。
対象デバイスが複数のパーティションを持ち得ると判断した場合、 eject は、
そ のデバイスのマウントされたパーティションをイジェクト前に全てアンマウ
ントしようとする。アンマウントに失敗すると、eject はメディアのイジェ ク
トを中止する。
音 楽 CD をイジェクトすることができる。 CD-ROM ドライブによっては、ドラ
イブが空である場合にトレイを開くことを拒否するものもある。トレイクロ ー
ズコマンドをサポートしないデバイスもある。
自動イジェクト機能が有効になると、そのドライブは eject を実行すると常に
イジェクトされるようになる。全ての Linux カーネル CD-ROM ドライバが、自
動 イジェクトモードをサポートするわけではない。自動イジェクトモードの状
態を確認する方法は無い。
デバイスファイルへのアクセスには適切な権限が必要である。デバイスによ っ
て は (例えば SCSI デバイス)、 eject を root で実行しなければならなかっ
たり、または eject を root に setuid しておくことが必要だったりする。
名前からデバイスを発見するために用いる探索法は、以下の通りである。名 前
の 末尾がスラッシュで終わる場合、それを取り除く (シェルのファイル名補完
機能を使って生成された名前をサポートするため)。名前が ’.’ または ’/’ で
始 まる場合は、名前をデバイスファイルまたはマウントポイントとみなしてオ
ープンを試みる。オープンに失敗すると、オープン可能なデバイスファイル ま
た は マ ウ ン トポイントが見つかるまで、 eject は名前の先頭に ’/dev/’,
’/media/’ ,’/mnt/’, ’/dev/cdroms’, ’/dev/rdsk/’, ’/dev/dsk/’, ’./’ を挿
入 して試す。 eject は、マウントされたデバイスを /etc/mtab でチェックす
る。これに失敗すると、eject は現在マウントされていないデバイスのマウ ン
トポイントを確認するために /etc/fstab もチェックする。
/dev/cdrom や /dev/zip のようなシンボリックリンクを作っておくことを勧め
る。こうすれば eject は適切なデバイスを覚えやすい名前を用いて特定できる
ようになるからである。
キー入力数を節約するため、あなたの環境固有の設定に合わせた eject オプシ
ョンへのシェルエイリアスを作るのもよいだろう。
著者
eject は Jeff Tranter (tranter@pobox.com) によって開発され、 GNU 一般公
有 使用許諾書の条件下でリリースされる。詳細については、COPYING ファイル
と、ソースコードの注記を参照のこと。
-x オプションは Nobuyuki Tsuchimura (tutimura@nn.iij4u.or.jp) によっ て
追加された。 Roland Krivanek (krivanek@fmph.uniba.sk) の cdrom_speed コ
マンドに感謝する。
-T オプションは Sybren Stuvel (sybren@thirdtower.com) によって追加さ れ
た。 Benjamin Schwenk (benjaminschwenk@yahoo.de) には非常に感謝している
。
-X オプションは Eric Piel (Eric.Piel@tremplin-utc.net) によって追加され
た。
関連項目
mount(2), umount(2), mount(8), umount(8)
/usr/src/linux/Documentation/cdrom/
Linux 12 May 2005 EJECT(1)
EJECT(1) User Commands EJECT(1)
NAME
eject - eject removable media
SYNOPSIS
eject -h
eject [-vnrsfmqp] []
eject [-vn] -d
eject [-vn] -a on|off|1|0 []
eject [-vn] -c slot []
eject [-vn] -i on|off|1|0 []
eject [-vn] -t []
eject [-vn] -T []
eject [-vn] -x []
eject [-vn] -X []
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 is ejected. The name can be a device
file or mount point, either a full path or with the leading "/dev",
"/media" 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 dis-
played 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
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.
-i on|1|off|0
This option controls locking of the hardware eject button. When
enabled, the drive will not be ejected when the button is pressed.
This is useful when you are carrying a laptop in a bag or case and
don’t want it to eject if the button is inadvertently pressed.
-t With this option the drive is given a CD-ROM tray close command.
Not all devices support this command.
-T With this option the drive is given a CD-ROM tray close command if
it’s opened, and a CD-ROM tray eject command if it’s closed. Not
all devices support this command, because it uses the above CD-ROM
tray close command.
-x
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 sup-
port 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.
-X With this option the CD-ROM drive will be probed to detect the
available speeds. The output is a list of speeds which can be used
as an argument of the -x option. This only works with Linux 2.6.13
or higher, on previous versions solely the maximum speed will be
reported. Also note that some drive may not correctly report the
speed and therefore this option does not work with them.
-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).
-m This option allows eject to work with device drivers which auto-
matically mount removable media and therefore must be always
mount(1)ed. The option tells eject to not try to unmount the
given device, even if it is mounted according to /etc/mtab or
/proc/mounts.
-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
-T --traytoggle
-x --cdspeed
-X --listspeed
-n --noop
-r --cdrom
-s --scsi
-f --floppy
-q --tape
-V --version
-p --proc
-m --no-unmount
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 multi-disc changer:
eject -v -c4 /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 Macin-
tosh 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/’, ’/media/’ ,’/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 remem-
bered 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 (kri-
vanek@fmph.uniba.sk) and his cdrom_speed command.
The -T option was added by Sybren Stuvel (sybren@thirdtower.com), with
big thanks to Benjamin Schwenk (benjaminschwenk@yahoo.de).
The -X option was added by Eric Piel (Eric.Piel@tremplin-utc.net).
SEE ALSO
mount(2), umount(2), mount(8), umount(8)
/usr/src/linux/Documentation/cdrom/
Linux 12 May 2005 EJECT(1)