In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "the usage of the Linux basic command eject". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "the usage of the Linux basic command eject".
Eject
The eject instruction allows removable media (usually optical discs, floppy disks, tapes, or Jaz or ZIP disks) to be ejected under software control. This command can also control some multi-CD converters with automatic eject functions supported by some devices, and close the disks of some CD drives.
The corresponding device is ejected. The name can be a device file or mount point, a complete path, or "/ dev", "/ media", or "/ mnt" omitted previously. If no name is specified, the default name "cdrom" is used.
There are four different eject methods depending on whether the device is a CD ROM, SCSI device, removable floppy disk, or tape. By default, pop-up tries all four methods sequentially until it succeeds. If the device is currently installed, uninstall it before ejecting.
The scope of this command: RedHat, RHEL, Ubuntu, CentOS, SUSE, openSUSE, Fedora.
1. Grammar
Eject-h
Eject [- vnrsfmqp] []
Eject [- vn]-d
Eject [- vn]-an 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
2. List of options
Option
Description
-h |-- help
Display simple help documentation
-V |-- version
Display command version information, and then exit
-v |-- verbose
The details are displayed when the instruction is executed, and you can see what the instruction is doing on the command line
-d |-- default
Displays the default device name (cdrom)
-an on | 1 | off | 0
This option controls the automatic pop-up mode and is supported only by some devices. If this switch is enabled, the device will pop up automatically when it is turned off.
-c |-- changerslot
Using this option, you can select a CD slot from the ATAPI/IDE CD-ROM converter. Linux2.0 or later is required to use this feature. When a change request is working, the CD-ROM drive (mounted data CD or music CD) cannot be used. Also notice that the first slot of the converter is called 0, not 1.
-I on | 1 | off | 0
This option locks the flyout so that it does not work. When enabled, the drive will not eject when the button is pressed. This is useful when you carry a laptop in a bag or box and do not want it to pop up if the button is inadvertently pressed.
-t |-- trayclose
With this option, the drive is given a CD-ROM tray close command. Not all devices support this command.
-T |-- traytoggle
If the CD-ROM tray is open, it will be closed; if the CD-ROM tray is closed, it will eject. Not all devices support this command because it uses the CD-ROM tray close command above.
-x |-- cdspeed
With this option, the CDROM drive can select the speed. The speed parameter is a number that indicates the desired speed (for example, 8 for 8X speed), or 0 for the most big data speed. Not all devices support this command, and you can only specify the speed that the drive can achieve. This option is cleared each time the media changes. This option can be used alone or with the-t and-c options.
-X |-- listspeed
Displays the available speed of the cdrom. Using this option, the CD-ROM drive is probed to detect the available speed. Outputs a list of speeds that can be used as an argument to the-x option. This applies only to Linux2.6.13 or later, and only the maximum speed is reported on previous versions. Also note that some drives may not report speed correctly, so the options do not apply to them.
-n |-- noop
Displays the selected device, but does nothing
-r |-- cdrom
Eject cdrom Devic
-s |-- scsi
Eject SCSI Devic
-f |-- floppy
Eject floppy Devic
-Q |-- tape
Eject tape device
-p |-- proc
Allow / proc/mounts instead of / etc/mtab
-m |-- no-umount
This option allows eject to work with device drivers that automatically mount removable media, so these devices must always be mounted. This option tells eject not to attempt to uninstall a given device, even if it is mounted based on / etc/mtab or / proc/ mount.
3 、 example
Function
Instruction
Pop up default Devic
Eject
Pop up a device or mount point named cdrom
Eject cdrom
Use the device name to pop up
Eject / dev/cdrom
Use the mount point to eject
Eject / mnt/cdrom
Eject the 4th IDE device
Eject hdd
Eject the first SCSI device
Eject sda
Pop up using the SCSI partition name
Eject sda4
Select disk 5 on a multi-disk switch
Eject-v-c4 / dev/cdrom
Turn on the automatic eject function on the sound projector CD-ROM
Eject-an on / dev/sbpcd
4. Description
The eject instruction returns 0 after successful execution and 1 if it fails.
The eject directive applies only to devices that support one or more of the four pop-up methods. This includes most CD-ROMs (IDE, SCSI, and proprietary), some SCSI tape drives, Jaz drives, ZIP drives (parallel ports, SCSI and IDE versions), and LS 120 removable floppy disks. Users also reported that floppy drives were also successful on Sun SPARC and Apple Macintosh systems. If the eject does not work, it is likely to be a limitation on the kernel driver of the device, rather than the popup itself.
The-r,-s,-f, and-Q options allow you to control the method used for pop-up. You can specify multiple methods. If these options are not specified, all four options are tried (which is good in most cases).
Eject is not always able to determine whether a device is installed (for example, whether it has multiple names). If the device name is a symbolic link, the pop-up will follow the link and use the device it points to.
If eject determines that the device can have multiple partitions, it will attempt to uninstall all installed partitions for the device before popping up. If the uninstall fails, the program will not attempt to eject the media.
You can pop up an audio CD. If the drive is empty, some CDROM will refuse to open the tray. Some devices do not support the pallet close command.
If the automatic eject feature is enabled, the drive will always eject after running this command. Not all linux kernel CDROM drivers support automatic pop-up mode and cannot find the state of automatic pop-up mode.
You need appropriate permissions to access device files. To eject some devices, such as SCSI devices, you need to run as root or setuidroot.
The heuristic method (given name) for finding the device is shown below. If the name ends with a trailing slash, delete it (to support the filename generated using the shell filename). If the name is "." Or "/", try to open it as a device file or mount point. If it fails, it attempts to put'/ dev/','/ media/','/ mnt/','/ dev/cdroms','/ dev/rdsk/','/ dev/dsk/', and last'. /'in front of the name until it finds a device file or mount point that can be opened. Install the device's program check / etc/mtab. If it fails, it also checks / etc/fSTAB to find the mount point of the currently unmounted device.
It is recommended that you create symbolic links, such as / dev/cdrom or / dev/zip, so that eject can use an easy-to-remember name to determine the appropriate device.
To save the type, you can create a shell alias for the pop-up options for specific settings work.
5. Examples
1) No device type is specified, and cdrom is popped up directly. In this case, all methods are tried in turn until they pop up.
[root@localhost ~] # eject-v / / use-v to display the process of instruction execution
Eject: using default device `cdrom'
Eject: device name is `cdrom'
Eject: expanded name is `/ dev/cdrom'
Eject: `/ dev/cdrom' is a link to` / dev/sr0'
Eject: `/ dev/sr0' is not mounted
Eject: `/ dev/sr0' is not a mount point
Eject: checking if device "/ dev/sr0" has a removable or hotpluggable flag
Eject: `/ dev/sr0' is not a multipartition device
Eject: trying to eject `/ dev/sr0' using CD-ROM eject command / / try the first pop-up method
Eject: CD-ROM eject command failed
Eject: trying to eject `/ dev/sr0' using SCSI commands / / try the second pop-up method
Eject: SCSI eject succeeded
2) use the "- r" option to pop up cdrom
[root@localhost ~] # mount / / check whether there is a CD mount
/ dev/mapper/VolGroup-lv_root on / type ext4 (rw)
...
/ dev/sr0 on / media/VBox_GAs_5.2.16 type iso9660 (ro,nosuid,nodev,uhelper=udisks,uid=0,gid=0,iocharset=utf8,mode=0400,dmode=0500)
[root@localhost] # eject-v-r / / eject CD
Eject: using default device `cdrom'
...
Eject: trying to eject `/ dev/sr0' using CD-ROM eject command
Eject: CD-ROM eject command succeeded
Thank you for your reading, the above is the content of "the usage of the Linux basic command eject". After the study of this article, I believe you have a deeper understanding of the usage of the Linux basic command eject, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.