In Linux, all storage devices need to be mounted before they can be used, and the purpose of mounting is to specify the type of this device to tell the Linux system how to access and control. However, in addition to hard disks, there are external storage devices such as optical disks and U disks. For different devices, the mounting method is also different.
1. Mounting of the disc:
Before the CentOS5 version, the device file name of the CD-ROM was / dev / hdc; after the CentOS6 version, the device file name of the CD-ROM was / dev / sr0. Although the device file names are different, there is a soft link like / dev / cdrom. easy to use.
1. First, you need to create a mount point (empty directory).
2. Use the mount command to mount
mount -t iso9660 / dev / cdrom mount point (write absolute path)
Since Linux also recognizes automatically, you can also ignore "-t iso9660"
mount / dev / cdrom Mount point (write absolute path) The effect is the same as above
ps:
1. If the mount point directory is not an empty directory, after the mounting is complete, the source files in the directory are not lost and are still on the hard disk, but this directory is no longer used as an "entry point" for the "original hard disk", but as a new mount The "entry point" of the storage device. After the storage device is uninstalled, this directory is used again as the "entry point" of the "original hard disk". Thus, the file can be read again.
2. After use, unmount the mounted disc. The following commands are fine.
umount /dev/cdrom
umount /mnt/cdrom
2. Mount the U disk.
1. The FAT format U disk can be used in both Windows system and Linux. But U disk is different from CD, U disk will use the device file naming method of hard disk. So you need to manually query the U disk device.
fdisk -l
Use the fdisk command to query the above information.
Mount command: mount -vfat / dev / sdb4 mount point (absolute path)
ps:
(1) If the file in the U disk contains Chinese characters, garbled characters may appear. To display Chinese, two prerequisites are required.
(A) Install Chinese encoding and Chinese fonts
(B) The operating terminal needs to support Chinese
(C) Specify the encoding method: mount -t vfat -o iocharset = utf-8 / dev / sdb4 Mount point (absolute path)
(2) Uninstall after use
umount mount point
2. Mount the USB disk in NTFS format
(1) Since Linux does not recognize the NTFS format by default, a plug-in needs to be installed to help the Linux system recognize the NTFS format.
Download and install the plug-in like NTFS-3G (in Linux, compile and install subsequent records)
(2) Mount
mount -t ntfs-3g / dev / sdb4 mount point
(3) Uninstall
umount -l mount point
3. fstab file (this file is modified with caution)
When the system is turned on, it will automatically read the / etc / fstab file to mount the device according to the parameters set in the file (you can modify the file to achieve automatic mounting).
First column: device / partition
Second column: mount point
Third column: file type
The fourth column: Mount type In most cases, select defaults (default), it represents seven default options (rw, suid.dev, exec, auto, nouser, async)
Fifth column: dump backup (a backup tool in Linux) 0 represents no backup 1 represents daily backup 2 represents irregular backup
Sixth column: whether to check at power on 0 means no check 1 means check first 2 means check after 1 is completed