Mount command (used to mount disks or images, etc.)

Usage: mount [-t vfstype] [-o options] Device dir 1, -t vfstype Specifies the type of the file system. Mount automatically selects the correct type. Common types are as follows: DOS FAT16 File system: MSDOS Windows 9x FAT32 File system: vFAT Windows NT NTFS File system: NTFS Windows Network file sharing: SMBFS (supported by all default Windows systems)

Windows Network shared files: CIFS (CIFS is an upgraded version of SMBFS, which is supported by default Windows operating systems. It is recommended first)

Cd-rom or CD-ROM image: ISO9660 UNIX(LINUX) File network sharing: NFS

2. -o options describes the mounting mode of devices or files. Common parameters are as follows: loop: mount a file as a disk partition to the system ro: mount the device in read-only mode RW: mount the device in read/write mode IOcharSET: specify the character set used to access the file system 3. Device Mount the device. 4. Dir Mount point of the device on the system.

5, monut remote or NTFS format support of native Windows partition: 1) according to the kernel installation NTFS support modules: sourceforge.net/projects/li… Specific process help: http://gerardmcgarry.com/blog/hacking-centos-ntfs-support instance: Sudo mount -t cifs //remotehostname/shared/MNT /myshared -o username=XXX,password=XXX 2) ntfs-3g—– yum install NTFS – 3 g (the fuse – NTFS – 3 g) references: www.zzdushi.com/?p=30 reference: http://ntfs-3g.org/ specific process helps: wiki.centos.org/TipsAndTric… Mount -t ntfs-3g /dev/sda1 / MNT/Windows (umount/MNT/Windows) Mount -o loop -t iso9660 /home/sunky/mydisk.iso/MNT /vcdrom To mount remote fat32 shared directory: Mount //10.167.20.20/shared/MNT /mywinshare Windows C partition to Liunx/MNT /winc directory: #mount -t vfat /dev/hda1 / MNT /winc #mount -t vfat -o iocharset=cp936 /dev/hda1 / MNT /winc (To mount a local Windows partition, use the command sudo fdisk -l in Ubuntu to check the disk partitions.) If a flash drive is identified as a SCSI disk, run the mount /dev/sda1/usb command

Second, FQA

1. What can I do with mount/umount? Different operating systems use different file system formats. Ms-dos supports FAT16 file system, Windows98 supports FAT16 and FAT32 file system, WindowsNT supports FAT16 and NTFS file system, and Windows2000 supports FAT16, FAT32 and NTFS file system formats. Linux supports almost all file system formats, but generally uses an ext2 or ext3 file system. Many users use Windows operating systems, and if they want to access resources from other file systems running Linux, they need to use the mount command. 2. What is the basic usage of mount? Format: mount [- Parameter] [Device name] [mount point] Common parameters are as follows: -a All file systems mounted in the /etc/fstab file. -f masquerades mount to check the device and directory, but does not actually mount the file system. -n Does not record the installation in the /etc/mtab file. -r indicates that the file system is installed as read-only. -v Displays detailed installation information. -w Installs the file system as writable by default.

-t < File system type > Specifies the file system type of the device. Common ones are: Ext2 Linux file system msdos MS-DOS fat, It is fat16 VFAT Windows98 commonly used FAT32 NFS network file system ISO9660 CD-ROM standard file system NTFS Windows NT/2000/XP file system auto automatic file system detection

-o < options > Specifies options for mounting the file system. Some options can also be written in /etc/fstab. Commonly used are: Defaults Uses the default values of all options (auto, nouser, rw, and suID) auto/noauto Allow/deny Installation with the -A option dev/nodev Specifies that/does not explain special devices on the file system exec/noexec Binary code suid/nosuid confirm/deny suid and sgid bit user /nouser allow/deny mounting codepage=XXX codepage iocharset=XXX character set ro mount rw in read-only mode Mount the file system in read/write mode remount remount the file system that has been installed loop mount the cyclotron username/password set the username and password that have access permission

Note that the mount point must be an existing directory. The directory may not be empty, but the previous contents of the directory will be unavailable after being mounted. After being unmounted, the directory will be restored to normal. When multiple -o arguments are used, the -o arguments are used only once, separated by semicolon commas:

# mount -- o remount,rw XXX XXXCopy the code

For example, if you want to mount disk D whose file system is FAT32 in Windows, generally speaking, the partition corresponds to /dev/hda5 in Linux. This partition may vary according to the specific partition situation. Here is hda5 as an example:

// # mount -t vfat /dev/hda5 / MNT /hda5 /Copy the code

In general, Linux will automatically probe the partition file system, so -t vfat can be omitted unless you specify it.

# mount /dev/hda5 /mnt/hda5
Copy the code

This allows access to the/MNT /hda5 directory to access resources in the partition. 3. Why Chinese files cannot be displayed as question marks or garbled characters after mounting partitions? The question mark shows that there is no Chinese font in your system that can be recognized. Please install Chinese font first. Make sure your system can display Chinese well. Garbled characters are usually displayed because the default file system encoding used by mount is inconsistent with the actual file encoding in the file system. To properly display the Chinese files, mount using the codePage and iocharset options in the -o argument. Codepage specifies the file system codepage. The Chinese code is 936. Iocharset Specifies the character set. Simplified Chinese characters are CP936 or GB2312.

# mount -- o iocharset=gb2312 codePage =936 /dev/hda5 / MNT /hda5Copy the code

Mount — o iocharset=cp936 /dev/hda5 / MNT /hda5 If you still have problems after doing this, try utF-8 encoding:

# mount -- o iocharset=utf8 /dev/hda5 / MNT /hda5Copy the code

4. Why cannot common users write partitions after the partition is mounted? Add — o umask=000 to mount:

# mount -- o umask=000, iocharset=cp936 /dev/hda5 / MNT /hda5Copy the code

5. Why are all files in the partition with short file names after being mounted? This is the cause of a filesystem mount error, which can occur when FAT32 is mounted as FAT16, umount and then remount with -t vfat to fix the problem.

# mount -t VAT /dev/hda5 / MNT /hda5Copy the code

6. Why cannot THE NTFS partition be mounted? This is why the kernel does not support THE NTFS file system. Please recompile the kernel or install the NTFS file system support package of the kernel so that the kernel has NTFS file system support. 7. How do I mount a USB flash drive and MP3 player? If the computer does not have other SCSI devices or USB peripherals and the device path of the usb disk is /dev/sda1, run the following command:

# mkdir /mnt/u
# mount /dev/sda1 /mnt/u
Copy the code

Mount it. 8. Can I use iso files directly? Yes, it is the option of mount that makes a free virtual drive available on Linux.

# mount -- o loop linux.iso/MNT /isoCopy the code

Of course, the mount point/MNT/ISO is also read-only after mounting. 9. Why can’t I mount the ISO file? In general, most distributions use kernels that have loop device support built into them, but sometimes not, so make sure your system uses a kernel that supports loop devices. The second case is when the ISO file is placed in NTFS or another read-only file system. The loop device must be mounted to a writable partition. Currently, the Linux kernel has limited write support for NTFS file systems. Copy the ISO file to another writable file system and mount it. 10. How to mount a CD/DVD-ROM drive or FDD? Generally, the CDROM device file is /dev/hdc and the FDD device name is /dev/fd0

# mkdir/MNT /cdrom # mount /dev/hdc/MNT /cdrom # mount /dev/hdc/MNT /cdrom # mount /dev/hdc/MNT /cdrom # mount /dev/hdc/MNT /cdromCopy the code

11. Why cannot Chinese files be displayed on the mounted CD-ROM? Using the -o iocharset=cp936 option generally solves the problem, otherwise use UTF-8 encoding.

# mount -- o iocharset=cp936 /dev/hdc/MNT /cdromCopy the code

12. How do I automatically mount partitions after startup? For example, if you want to mount /dev/hda5 automatically, add the following lines:

/dev/hda5 /mnt/hda5 vfat defaults,iocharset=cp936, rw 0 0
Copy the code

13. How do I mount a Samba partition?

# mount -t SMBFS -o username=root,password= ABC, codePage =936,iocharset=gb2312 //192.168.1.100/share /mnt/shareCopy the code

If the Chinese display is abnormal, try utF-8 encoding. Of course, you can write to fstab for automatic mount. 14. What does mount –bind mean? Mount –bind is to mount the contents of one directory to another directory

# mount --bind olddir newdir
Copy the code

This command makes it very convenient for your FTP to share a directory. To cancel the mount use the following command:

# mount --move olddir newdir
Copy the code

If mount –bind also wanted to write to fstab, it would look like this:

olddir newdir none bind 0 0
Copy the code

15. What is the basic usage of umount? For example, /dev/hda5 has been mounted to/MNT /hda5. You can run the following three commands to unmount the mounted file system

# umount /dev/hda5
# umount /mnt/hda5
# umount /dev/hda5 /mnt/hda5
Copy the code

16. Why is device Busy always displayed when umount? This is because an application is accessing the device. The easiest way to do this is to exit the application and then unmount it. Sometimes the user is confused about what program is accessing the device. If the user is not in a hurry to umount, they can use:

# umount -l /mnt/hda5
Copy the code

To unload the device. The -l option is not umount immediately, but umount after the directory is free. You can also use the ps aux command to view the process PID occupying the device, and then use the command kill to kill the process occupying the device, so umount is very assured.