Linux Mount/unmount Commands

Source: Internet
Author: User

Format: Mount [-parameter] [device name] [Mount Point]
Among the parameters commonly used are:
-A installs all file systems that are class-out in the/etc/fstab file.
-F disguises mount, making checks on the device and the directory look, but does not really mount the file system.
-N does not record the installation in the/etc/mtab file.
-R tells the file system to be installed as read-only.
-V Displays the installation information in detail.
-W installs the file system as writable, which is the default for the command.
-t specifies the file system type of the device, which is common:
EXT2 Linux currently used file system
Msdos MS-DOS FAT, is FAT16
VFAT Windows98 commonly used FAT32
NFS Network File System
ISO9660 CD-ROM standard file system
File system for NTFS Windows NT/2000/XP
Auto automatically detects the file system
-o Specifies the option to mount the file system, and some can also be written to the/etc/fstab. Commonly used are:
Defaults Use default values for all options (auto, Nouser, RW, suid)
Auto/noauto Allow/disallow installation with the –A option
Dev/nodev/Do not interpret special devices on file systems
Exec/noexec Allow/Disallow binary code execution
Suid/nosuid Confirm/Not confirm suid and Sgid bit
User/nouser Allow/Disallow normal users to mount
CODEPAGE=XXX code page
Iocharset=xxx Character Set
RO mount in read-only mode
RW mount in read-write mode
Remount Reinstall a file system that has already been installed
Loop Mount Cyclotron Device

Note that the mount point must be a directory that already exists, this directory may not be empty, but the previous contents of this directory will not be available after mounting, Umount will return to normal later. When using multiple-o parameters,-O is used only once, and the parameters are separated by commas:

CODE:
# Mount–o REMOUNT,RW/
For example, to mount the file system in Windows FAT32 D-disk, generally under Linux this partition corresponds to/dev/hda5, depending on the specific partition situation will be different, here is hda5 to illustrate:
CODE:
# mkdir HTTP://WWW.QIXOO.QIXOO.COM/MNT/HDA5//create hda5 directory as mount point, location and directory name can be customized//
# mount-t Vfat/dev/hda5/mnt/hda5
In general, Linux automatically detects the file system of a partition, unless you specify it, the-t vfat can be omitted.
CODE:
# MOUNT/DEV/HDA5/MNT/HDA5
This allows access to the/MNT/HDA5 directory for resources in the partition.
3. Why does the partition on Mount not display Chinese file as question mark/garbled?
Display a question mark indicating that there is no recognizable Chinese font in your system, please install the Chinese font first. Make sure your system is already well-displayed in Chinese. Shown as garbled is generally caused by the file system encoding used by the mount default and the actual encoding inconsistencies in the file system. To display Chinese files normally, mount requires the codepage and Iocharset options in the-o parameter. CODEPAGE specifies the code page of the file system, the Chinese code is 936;iocharset specified character set, Simplified Chinese is generally used cp936 or gb2312.
CODE:
# Mount–o iocharset=gb2312 Codepage=936/dev/hda5/mnt/hda5
Generally speaking, mount–o iocharset=cp936/dev/hda5/mnt/hda5 can solve the problem.
If you have problems with this, try UTF-8 encoding:
CODE:
# Mount–o Iocharset=utf8/dev/hda5/mnt/hda5
4. Why is the partition normal user not writable after mount up?
Mount with –o umask=000:
CODE:
# Mount–o umask=000, Iocharset=cp936/dev/hda5/mnt/hda5
5. Why did the files in the partition after mount go into short filenames?
This is the reason why the file system hangs wrong, when the FAT32 is mounted as FAT16, this happens, first Umount, and then re-mount with –t vfat to solve the problem.
CODE:
# Mount–t VAT Http://qkxue.net/dev/hda5/mnt/hda5
6. Why can't I mount an NTFS partition?
This is why the kernel does not support the NTFS file system, please recompile the kernel or install the NTFS file system support package for the kernel so that the kernel has NTFS file system support.
7. How do I mount a USB stick and mp3?
If the computer does not have other SCSI devices and USB peripherals, the device path of the inserted USB drive is/dev/sda1, using the command:
CODE:
# mkdir/mnt/u
# mount/dev/sda1/mnt/u
Mount it.
8. Can I use the ISO file directly?
Yes, this option for mount makes it possible to have a free virtual optical drive under Linux, with the following specific usage:
CODE:
# Mkdir/mnt/iso
# Mount–o Loop Linux.iso/mnt/iso
Of course, mounting the mount point/mnt/iso is also read-only.
9. How can I not mount an ISO file?
In general, the kernel used by most distributions has compiled support for the loop device, but there is no case, so make sure that the kernel used by the system supports the loop device.
The second case is that the ISO file is placed in NTFS or other read-only file systems. The Mount loop device must be mounted to a writable partition, and currently the Linux kernel has very limited write support for the NTFS file system, please copy the ISO file to another writable file system before mounting.
10. How to mount the optical drive and floppy drive
Generally CDROM device file is/DEV/HDC, the device name of the floppy drive is/dev/fd0
CODE:
# Mkdir/mnt/cdrom
# Mount/dev/hdc/mnt/cdrom//Mount Optical Drive//
# Mkdir/mnt/floppy
# Mount/dev/fd0/mnt/floppy//Mount Floppy//
11. Why does the attached CD-ROM not display Chinese files?
Using the –o iocharset=cp936 option will generally solve the problem, otherwise use utf-8 encoding.
CODE:
# Mount–o Iocharset=cp936/dev/hdc/mnt/cdrom
12. How do I automatically mount partitions on boot?
It is cumbersome to enter such a long command for each mount, as long as the partition information is written to the/etc/fstab file to automatically mount the system boot, for example, to add the following line to the/DEV/HDA5 auto mount:
CODE:
/dev/hda5/mnt/hda5 vfat defaults,iocharset=cp936, rw 0 0
13. How can I mount a samba partition?
CODE:
# Mkdir/mnt/share
# mount-t Smbfs-o Username=root,password=abc,codepage=936,iocharset=gb2312//192.168.1.100/share/mnt/share
If the Chinese display is not normal, try UTF-8 encoding. Of course, you can write to the fstab to implement automatic mounting.
What does Mount--bind mean?
Mount--bind is to mount the contents of one directory to another directory, using the
CODE:
# Mount--bind Olddir newdir
This command makes it especially convenient for you to set up FTP to share a directory. If you want to cancel the Mount command:
CODE:
# Mount--move Olddir newdir.
If Mount--bind also wants to write to Fstab, the format is as follows:
CODE:
Olddir newdir None bind 0 0
What is the basic usage of umount?
For example,/DEV/HDA5 has been mounted on the/MNT/HDA5, using three commands can be uninstalled mounted file system
CODE:
# UMOUNT/DEV/HDA5
# UMOUNT/MNT/HDA5
# UMOUNT/DEV/HDA5/MNT/HDA5
16. Why does the Umount show device busy?
This is because there is a program is accessing the device, the simplest way is to let the program to access the device to quit and then Umount. There may be times when users do not clear exactly what program is accessing the device, and if the user is not anxious to umount, it can be used:
CODE:
# umount-l/mnt/hda5
To uninstall the device. The option –l is not immediately umount, but umount after the directory is idle. You can also use the command PS aux to see the device's program PID, and then use the command kill to kill the process of occupying the device, so umount very relieved.

Method One:
Fuser-m-v/nfs_old/
User Process number Permission command
/nfs_old/: Root 2699. C.. bash
Root 2999.. C.. su
As shown above, there are two processes occupied, kill them, and then cancel the mount again.
Kill-9 2699 2999
umount/nfs_old/

Method Two:
Umount-l/nfs_old/

Method Three:
fuser-km/nfs_old/

Linux mount/unmount Command (GO)

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.