Basic usage of Linux mount command and umount command

Source: Internet
Author: User

Before giving you a detailed introduction to the Linux mount command, first let you know about the Linux mount command, and then give a comprehensive introduction to the Linux mount command. The Linux mount command is still commonly used, so I studied the Linux mount command and shared it with you here. I hope it will be useful to you.

1. What can I do with Linux mount/umount?

Different operating systems use different file system formats. MS-DOS supports FAT16 file system, Windows98 supports FAT16, FAT32 file system, WindowsNT supports FAT16, NTFS file system, Windows2000 supports FAT16, FAT32, NTFS file system format, linux supports almost all file system formats, but ext2 or ext3 is generally used. Many users use a windows operating system. to access resources in other file systems in a running Linux system, use the Linux mount command.

2. What is the basic usage of the Linux mount command?

Format: Linux mount Command [-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 types include:
Ext2 common file systems in linux
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 auto, nouser, rw, and suid for all options)
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
Username/password is used to set the user name and password with access permissions.

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:
# Mount-o remount, rw XXX
For example, if you want to mount a d disk with the file system FAT32 in windows, the partition corresponds to/dev/hda5 in Linux, which varies according to the specific partition conditions, here we use hda5 as an example:
# 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
In general, Linux automatically detects the partition file system. Unless specified by you,-t vfat can be saved.
# Mount/dev/hda5/mnt/hda5
In this way, you can 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 partitioning on the Linux mount command?

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 generally caused by inconsistent File System encoding used by the Linux mount command with the actual file encoding in the file system. To display Chinese files normally, the codepage and iocharset options in the-o parameter must be used for Linux mount command t. 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.

# Linux mount command-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: # mount-o iocharset = utf8/dev/hda5/mnt/hda5

4. Why can't common users write partitions after the Linux mount command is run?

Add-o umask = 000 to the Linux mount command: # mount-o umask = 000, iocharset = cp936/dev/hda5/mnt/hda5

5. Why do all the files in the partition after the Linux mount command 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. # 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: # mkdir/mnt/u # mount/dev/sda1/mnt/u mount.

8. Can I directly use the iso file?

Yes. This option of the Linux mount command enables free virtual optical drive in Linux. The specific usage is: # mkdir/mnt/iso # mount-o loop linux. 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. Currently, the Linux 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 the optical drive and soft drive using the Linux mount command

Generally, the CDROM device file is/dev/hdc, the device name of the soft drive is/dev/fd0 # 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. # 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 mounting of/dev/hda5:/dev/hda5/mnt/hda5 vfat defaults, iocharset = cp936, rw 0 0

13. How to mount samba partitions?

# 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. Its usage is # mount -- bind olddir newdir, which makes it very convenient to build an FTP to share a directory. To cancel the mount, run the command # mount -- move olddir newdir. If you want to write mount -- bind to fstab, the format is as follows: 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:
# 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 you may not know what program is accessing the device. If you are not in a rush to umount, you can use # 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.

  1. Linux mount Command System mounting and image processing
  2. The most basic commands in the Linux mount command
  3. Linux vmstat process information and memory information
  4. Linux PHP compilation and generation extension and Configuration Modification
  5. Ubuntu Linux is more powerful, faster, and better

Related Article

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.