The learning objective is to access data in CDROM.
The learning objective is to access data in CDROM.
Linux displays that all directories are under one directory tree, regardless of which drive/hardware they are located.
The disk content in Linux appears as a subdirectory. The content of removable media will not automatically appear in these self-directories,
We must mount the drive.
Use the mount command to mount CDROM.
Command:
Mount-T Auto/dev/CDROM/mnt/CDROM
This command is to mount the CDROM to the/mnt/CDROM directory. Here I can access the content.
Learning operation process:
[OK _008 @ centos4 ~] $ Mount-T Auto/dev/CDROM/mnt/CDROM
Mount: only root can do that -- generally, users cannot mount CDROM, and only root users can perform this operation.
[OK _008 @ centos4 ~] $
-- Switch user operation:
[Root @ centos4/] # Mount-T Auto/dev/CDROM/mnt/CDROM
Mount: mount point/mnt/CDROM does not exist --/mnt/CDROM directory does not exist. You need to create it first.
[Root @ centos4/] # cd/mnt
-Bash: CD:/mnt: no such file or directory
[Root @ centos4/] #
[Root @ centos4/] # mkdir-P/mnt/CDROM -- create/mnt/CDROM directory
[Root @ centos4/] # ls
Bin Dev home lib media MNT proc sbin srv tmp VaR
Boot etc initrd lost + found MISC opt root SELinux sys USR
[Root @ centos4/] # Mount-T Auto/dev/CDROM/mnt/CDROM -- Mount CDROM
Mount: block device/dev/CDROM is write-protected, mounting read-only -- Mount successful
[Root @ centos4/] # ls-L/mnt/CDROM -- View content in CDROM
Total 859
Dr-XR-x 4 Root 2048 Sep 4 2005 centos
-R -- 2 root Root 8859 Mar 19 2005 centosdocs-man.css
-R -- 9 Root 18009 Mar 1 2005 GPL
Dr-XR-x 2 root Root 241664 May 7 Headers
Dr-XR-x 4 Root 2048 May 7 images
Dr-XR-x 2 root Root 4096 May 7 isolinux
Dr-XR-x 2 root Root 18432 May 2 Notes
-R -- 2 root Root 5443 May 7 0:49 RELEASE-NOTES-en.html
Dr-XR-x 2 root Root 2048 May 7 repodata
-R -- 9 Root 1795 Mar 1 2005 RPM-GPG-KEY
-R -- 2 root Root 1795 Mar 1 2005 RPM-GPG-KEY-centos4
-R -- 1 Root 571730 May 7 yumgroups. xml
[Root @ centos4/] #
[Root @ centos4/] # umount/mnt/CDROM -- unmount CDROM. It is easy to directly use umount/mnt/CDROM.
Other parameters of the mount command can be described as follows::
Name: Mount
Permission: system administrator or user allowed in/etc/fstab
Usage:
Mount [-HV]
Mount-A [-ffnrsvw] [-T vfstype]
Mount [-fnrsvw] [-O options [,...] device | dir
Mount [-fnrsvw] [-T vfstype] [-O options] device dir
Note:
Interpret the content of an archive into an archive system, and then place it on a location in the directory. After this command is successfully executed, all files under this command cannot be called until we use umnount to remove the file system.
This command can be used to mount any file system. You can even use the-o loop option to split a general file into a hard disk and then mount it to the system. This function is very useful for interpreting image files of ramdisk, romdisk, or ISO 9660.
Parameters
-V
Show program version
-H
Show auxiliary messages
-V
Displays more information, usually used with-F for debugging.
-
Mount all file systems defined in/etc/fstab.
-F
This command is usually used together with-a, which generates a route for each Mount action. You can speed up mounting when the system needs to mount a large number of NFS file systems.
-F
It is usually used for debugging. It will make the mount not execute the actual action, but simulate the entire process of mounting. It is usually used with-v.
-N
Generally, after Mount is mounted, a message is written to the/etc/mtab. However, you can use this option to cancel this operation if the file system does not exist.
-S-R
Equal to-O Ro
-W
Equal to-O RW
-L
Separate the hard disks with specific tags.
-U
Mount the file system with the file division serial number. -L and-u must exist in the/proc/partition file to make sense.
-T
Specifies the type of the file system, which is usually not required. Mount automatically selects the correct type.
-O async
When the non-synchronous mode is enabled, all file read and write operations are performed in non-synchronous mode.
-O sync
Run the command in synchronization mode.
-O atime
-O noatime
When atime is enabled, the system updates the "Last call time" of the file each time the file is read 』. When we use the flash file system, we may choose to disable this option to reduce the number of writes.
-O auto
-O noauto
Enable/disable automatic mounting mode.
-O defaults
Use the default options RW, SUID, Dev, exec, auto, nouser, and async.
-O Dev
-O nodev-O Exec
-O noexec
The execution file can be executed.
-O SUID
-O nosuid
The execution file can be executed with the root permission.
-O User
-O nouser
You can perform the Mount/umount action.
-O remount
You can use different methods to re-mount an existing file system. For example, a previously read-only system can be re-mounted in the read-write mode.
-O Ro
Use the read-only mode.
-O RW
In read/write mode.
-O loop =
Loop mode is used to separate an archive into a hard disk and mount it to the system.
Example
Mount/dev/hda1 under/MNT.
# Mount/dev/hda1/mnt
Mount/dev/hda1 in read-only mode under/MNT.
# Mount-O ro/dev/hda1/mnt
Mount the image file of the/tmp/image. ISO disc in loop mode under/mnt/CDROM. In this way, you can view the Linux optical disc ISO files that can be found on the network without burning them into CDs.
# Mount-o loop/tmp/image. ISO/mnt/CDROM
Related commands umount