Mount/unmount command

Source: Internet
Author: User

 

If you want LinuxTo access resources in other file systems, use the mount command.   2. What is the basic usage of mount?

Format: Mount [-parameter] [device name] [mount point]

Common parameters include:

-A: All file systems installed in the/etc/fstab file.

-F disguises the mount and checks the device and directory, but does not actually mount the file system.

-N does not record installation in the/etc/mtab file.

-R indicates that the file system is read-only.

-V displays the installation information in detail.

-W: Install the file system as Writable, which is the default command.

-T <file system type> specifies the file system type of the device., Common include:

Ext2LinuxCommon File Systems

Msdos MS-DOS fat, is fat16

FAT32 commonly used in vfat Windows98

NFS Network File System

ISO CD-ROM CD standard file system

NTFS Windows NT/2000/XP File System

Auto automatically detects the File System

-O <option> specifies the option when mounting the file system, and some can also be written to/etc/fstab. Commonly used:

Defaults uses the default values of all options (Auto, nouser, RW, and SUID)

Auto/noauto allow/do not allow installation with the-A Option

Dev/nodev does not explain/to special devices on the file system

Exec/noexec allowed/not allowed to execute binary code

SUID/nosuid confirm/unconfirm SUID and SGID bit

User/nouser allow/do not allow general users to mount

CodePage = xxx code page

Iocharset = xxx Character Set

RO mounting in read-only mode

RW mounting in read/write mode

Remount reinstalls the installed File System

Loop mounting of a maneuver Device

It should be noted that the mount point must be an existing Directory, which may not be empty, but the previous contents in this directory will not be available after mounting, umount will return to normal later. When multiple-O parameters are used,-O is used only once, and the parameters are separated by commas:
[Copy to clipboard]

Code:

# Mount-O remount, RW/For example, to mount a Windows D disk whose file system is FAT32 LinuxThe next partition corresponds to/dev/hda5, which varies according to the specific partition situation. Here we use hda5 as an example:

[Copy to clipboard]

Code:

# Mkdir/mnt/hda5 // create the hda5 directory as the mount point. The location and directory name can be customized //

# Mount-T vfat/dev/hda5/mnt/hda5

Generally, LinuxThe system automatically detects the partition file system. Unless specified, the-T vfat can be saved.

[Copy to clipboard]

Code:

# Mount/dev/hda5/mnt/hda5 to access the resources in the partition in the/mnt/hda5 directory.

3. Why cannot the Chinese file be displayed as question mark/garbled characters after the partition is mounted?

A question mark indicates that your system does not have any Chinese fonts that can be recognized. Install Chinese fonts first. Make sure that your system can display Chinese properly. Garbled characters are usually caused by inconsistent File System encoding used by the Mount by default with the actual encoding of files in the file system. To properly display Chinese files, use the codePage and iocharset options in the-O parameter during mount. CodePage specifies the code page of the file system. The Chinese code in simplified Chinese is 936. iocharset specifies the character set. cp936 or gb2312 is generally used for simplified Chinese.

[Copy to clipboard]

Code:

# Mount-O iocharset = gb2312 codePage = 936/dev/hda5/mnt/hda5 Mount-O iocharset = cp936/dev/hda5/mnt/hda5 to solve the problem.

If there is still a problem after doing so, try UTF-8 encoding:

[Copy to clipboard]

Code:

# Mount-O iocharset = utf8/dev/hda5/mnt/hda5 4. Why can't common users write partitions after mounting?

Add-O umask = 000 to the Mount:

[Copy to clipboard]

Code:

# Mount-O umask = 000, iocharset = cp936/dev/hda5/mnt/hda5 5. Why do all the files in the mounted partition become short file names?

This is why the file system fails. This problem occurs when FAT32 is mounted to fat16. First, umount and then re-mount it with-T vfat to solve the problem.

[Copy to clipboard]

Code:

# Mount-t vat/dev/hda5/mnt/hda5 6. Why cannot I mount NTFS partitions?

This is why the kernel does not support the NTFS file system. Re-compile the kernel or install the NTFS file system support package for the kernel to support the NTFS file system.

7. How to mount a USB flash drive and MP3?

If the computer does not have other SCSI devices and USB peripherals, the path of the inserted USB flash drive device is/dev/sda1. Run the following command:

[Copy to clipboard]

Code:

# Mkdir/mnt/u

# Mount/dev/sda1/mnt/u

Mount.

8. Can I directly use the ISO file?

Yes, that is, the mount option makesLinuxWhich of the following statements about free virtual optical drive is used:

[Copy to clipboard]

Code:

# Mkdir/mnt/ISO

# Mount-o loopLinux. ISO/mnt/ISO, of course, the mount point/mnt/ISO after mounting is also read-only.

9. Why can't I mount an ISO file?

In general, the kernel used by most distributions has compiled the support for loop devices, but there is no such situation. Therefore, ensure that the kernel used by the system supports loop devices.

The second case is that the ISO file is stored in NTFS or other read-only file systems. The loop device must be mounted to a writable partition. CurrentlyLinuxThe kernel has limited write support for the NTFS file system. Copy the ISO file to another writable file system and then mount it.

10.How to mount an optical driveAnd soft drive

In general, the CDROM device file is/dev/HDC, and the disk drive device name is/dev/fd0.

[Copy to clipboard]

Code:

# Mkdir/mnt/CDROM

# Mount/dev/HDC/mnt/CDROM // mount the optical drive //

# Mkdir/mnt/floppy

# Mount/dev/fd0/mnt/Floppy // mount a soft drive //

11. Why does the mounted CD-ROM fail to display Chinese files?

The-O iocharset = cp936 option can solve the problem. Otherwise, UTF-8 encoding is used.

[Copy to clipboard]

Code:

# Mount-O iocharset = cp936/dev/HDC/mnt/CDROM 12. How can I mount partitions automatically when I start the system?

It is really complicated to enter such a long command for each mounting. You only need to write the partition information to the/etc/fstab file to enable automatic mounting of the system startup, for example, add the following lines to the automatic mount of/dev/hda5:

[Copy to clipboard]

Code:

/Dev/hda5/mnt/hda5 vfat defaults, iocharset = cp936, RW 0 0 13. How to mount Samba partitions?

[Copy to clipboard]

Code:

# Mkdir/mnt/share

# Mount-T smbfs-O username = root, password = ABC, codePage = 936, iocharset = gb2312 // 192.168.1.100/share/mnt/share if Chinese characters are not displayed, try UTF-8 encoding. Of course, you can write it to fstab for automatic mounting.

14. What does Mount -- bind mean?

Mount -- BIND is to mount the content in one directory to another. usage is

[Copy to clipboard]

Code:

# Mount -- BindThe olddir newdir Command makes it very convenient to build an FTP to share a directory. To cancel the mount, run the following command:

[Copy to clipboard]

Code:

# Mount -- MoveOlddir newdir. If Mount -- bind also wants to write data to fstab, the format is as follows:

[Copy to clipboard]

Code:

Olddir newdir none bind 0 0 15. What is the basic usage of umount?

For example, if/dev/hda5 has been mounted to/mnt/hda5, you can run the following three commands to unmount the mounted file system:

[Copy to clipboard]

Code:

# Umount/dev/hda5

# Umount/mnt/hda5

# Umount/dev/hda5/mnt/hda5

16. Why is Device Busy always displayed during umount?

This is because a program is accessing this device. The simplest way is to let the program accessing this device exit and then umount. Sometimes users may not know what programs are accessing the device. If you are not in a rush to umount, you can use:

[Copy to clipboard]

Code:

# Umount-L/mnt/hda5 to uninstall the device. Option-l does not immediately umount, but umount after the directory is idle. You can also use the command PS aux to view the PID of the program that occupies the device, and then use the command kill to kill the process that occupies the device, so that umount is very relieved. From: http://blog.chinaunix.net/u3/93290/showart_1884343.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.