"Reprint" Linux under the Mount command detailed;

Source: Internet
Author: User

The following are from: http://blog.csdn.net/clozxy/article/details/5299054

Http://linux.chinaunix.net/techdoc/system/2007/06/17/960372.shtml

http://tutu.spaces.eepw.com.cn/articles/article/item/70737

Umount

Function: In contrast to the function of mount, uninstalling the device, umount the back with the mount point or device name (such as/DEV/SDA5), can not be with the label and UUID;

Mount

Function:

Loads the specified file system, and mount loads the file system specified on the specified device into the Linux directory (that is, the mount point). You can write frequently used devices to file/etc/fastab so that the system automatically loads every time you start. The Mount loading device information is logged in the/etc/mtab file. When you uninstall a device by using the Umount command, the record is cleared.

Usage:

Mount [-AFFHNRVVW] [-l< label;] [-o< option;] [-t< file system type;] [device name] [load Point]

Parameters:

-A loads all the devices that are set in the file/etc/fstab.
-F does not physically load the device.  Can be used in conjunction with the-v parameter to view the execution of Mount. Pretending to mount, making a check on the device and the directory look like, but not really mounting the filesystem.
-F must be used in conjunction with the-a parameter. All devices set in/etc/fstab are loaded at the same time to speed up execution.
-H Displays the online Help information.
-l< tags > load file system labeled < tags > devices.
-N does not record the loading information in the/etc/mtab file.

-R loads the device in read-only mode.

-V displays detailed information when executed.
-V Displays version information.

-o< Options > Specify options when loading the file system. Some options can also be used in/etc/fstab. Multiple-o arguments,-O is only written once, and multiple parameters are separated by commas: These options include:

Async performs the input and output actions of the file system in an asynchronous manner.
Atime Each access updates the Inode's access time, the default setting, and the Cancel option is noatime.
Auto must specify this option in the/etc/fstab file. When the-a parameter is executed, the device set to Auto is loaded and deselected as Noauto.

Noauto cannot use the-a parameter to load.

Defaults uses the default options. The default options are RW, suid, dev, exec, Anto Nouser, and async.
Dev readable character or block device on the filesystem, the Cancel option is Nodev.

Nodev does not read characters or block devices on the file system.

exec executable binary file, cancel option is noexec.
Noatime does not update inode access time for each access.

NOEXEC cannot execute binary file.
Nosuid off Set-user-identifier (set User ID) with Set-group-identifer (set group ID) setting bit.
Nouser makes it impossible for a user to perform the load operation, the default setting.
Remount Reload the device. Typically used to change the device's setting state.
RO is loaded in read-only mode.
RW is loaded in read-write mode.
Suid start Set-user-identifier (set User ID) with Set-group-identifer (set group ID) Set bit, cancel option is nosuid.
Sync performs the input and output actions of the file system in a synchronous manner.
User can let the general user load the device.

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 to mount a file as a hard disk partition;

The above content is a bit repetitive, but nothing, see better understand AH;


-t< File System Type > Specifies the file system type of the device. The commonly used options are as follows:

Minix The earliest file system used by Linux.
Ext2 Linux is currently a common file system.
Msdos MS-DOS FAT.
VFAT Win85/98 's VFAT.
NFS Network File System.
iso9660 a standard file system for CD-ROM discs.
NTFS file system for Windows NT.
HPFS OS/2 file System. File systems prior to Windows NT 3.51.
Auto automatically detects the file system.

Example: From (http://tutu.spaces.eepw.com.cn/articles/article/item/70737)

Mount (Mount) of the disc image file

#mkdir/mnt/vcdrom
Note: Create a directory to use as a mount point
#mount-O loop-t iso9660/home/sunky/mydisk.iso/mnt/vcdrom
Note: You can access all the files in the disk image file Mydisk.iso using/mnt/vcdrom.

Hooking up a removable hard disk
for Linux systems, the USB interface's removable hard disk is treated as a SCSI device. Before inserting a removable hard disk, you should first use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partition.
[Root at Pldyrouter/]# fdisk-l
After the removable hard drive, then use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partition. You should be able to find one more SCSI HDD/dev/ SDC and its two disk partitions/dev/sdc1,/DEV/SDC2, where/DEV/SDC5 is the logical partition of the/DEV/SDC2 partition. We can use the following command to hook up/DEV/SDC1 and/DEV/SDC5.
#mkdir-P/mnt/usbhd1
#mkdir-P/MNT/USBHD2
Note: Create a directory to use as a mount point
#mount-T NTFS/DEV/SDC1/MNT/USBHD1
#mount-T VFAT/DEV/SDC5/MNT/USBHD2
Note: You should use the-T NTFS parameter for NTFS-formatted disk partitions, and the-T VFAT parameter for disk partitions in FAT32 format. If the kanji file name is displayed as garbled or not displayed, you can use the following command format.
#mount-T ntfs-o iocharset=cp936/dev/sdc1/mnt/usbhd1
#mount-t vfat-o iocharset=cp936/dev/sdc5/mnt/usbhd2
Using the Fdisk partitioning command and the Mkfs file system creation command under the Linux system, the partition of the removable hard disk can be made into the ext2, ext3 format peculiar to the Linux system. This makes it easier to use under Linux. Use the following command to hook up directly.
#mount/dev/sdc1/mnt/usbhd1

The

Mount USB flash drive
is treated as a SCSI device to the Linux system, just like the USB port's removable hard disk. Use the same method as moving the hard disk. Before inserting a USB flash drive, you should first use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partition.
[Root at Pldyrouter root]# fdisk-l
Insert the USB drive, then use Fdisk–l or more/proc/partitions to view the system's hard disk and hard disk partition.
[Root at Pldyrouter root]# fdisk-l
System has a SCSI hard disk/DEV/SDD and a disk partition/DEV/SDD1,/DEV/SDD1 is the USB stick we want to hook up.
#mkdir-P/MNT/USB
Note: Set up a directory to use as a mount point
#mount-T VFAT/DEV/SDD1/MNT/USB
Note: You can now access the USB drive by/mnt/usb, If the kanji file name is displayed as garbled or not displayed, you can use the following command.
#mount-T vfat-o iocharset=cp936/dev/sdd1/mnt/usb

Hooking up Windows file shares
The core of Windows network sharing is smb/cifs, where you have to install and use the Samba package if you want to mount a disk share for Windows on Linux. The majority of popular Linux distributions now contain samba packages, and if you install a Linux system without samba, install Samba first. Of course, you can also download the www.samba.org website ... The new version is 3.0.10 version.
When the Windows system share is set up, you can hook up (mount) on the Linux client, with the following details:
# Mkdir–p/mnt/samba
Note: Create a directory to use as a mount point
# mount-t Smbfs-o username=administrator,password=pldy123//10.140.133.23/c$/mnt/samba
Note: Administrator and pldy123 are a user name and password for the IP address of the 10.140.133.23 Windows computer, and C $ is a disk share on this computer
This allows you to access the files on the Windows system disk via/mnt/samba on your Linux system. These actions are tested in Redhat as server 3, Redflag Server 4.1, SuSE Server 9, and Windows NT 4.0, Windows 2000, Windows XP, Windows 2003 environments.

Hooking up UNIX System NFS file shares
Similar to the Windows-based network share, UNIX (Linux) systems also have their own network shares, that is, NFS (Network File system), below we are in the Sun Solaris2.8 and Redhat as server 3 For example, briefly describe how to mount an NFS network share under Linux.
Before the Linux client mounts (Mount) NFS disk share, the NFS server must be configured first.
1. The Solaris system NFS Server configuration method is as follows:
(1) Modify/etc/dfs/dfstab, add shared directory
Share-f Nfs-o Rw/export/home/sunky
(2) Start the NFS service
#/etc/init.d/nfs.server Start
(3) After the NFS service is started, you can also use the following command to add a new share
# Share/export/home/sunky1
# Share/export/home/sunky2
Note:/export/home/sunky and/export/home/sunky1 are directories that are ready to be shared
2, the Linux system NFS server configuration method is as follows:
(1) Modify/etc/exports, add shared directory
/export/home/sunky 10.140.133.23 (rw)
/export/home/sunky1 * (rw)
/export/home/sunky2 linux-client (rw)
Note: Sunky, Sunky1, sunky2 in the/export/home/directory are the directories that are ready to be shared, 10.140.133.23, *, and linux-client are the IP addresses or host names that are allowed to hook up this shared Linux client. If you want to use hostname linux-client You must add the Linux-client host IP definition in the server host/etc/hosts file. The format is as follows:
10.140.133.23 linux-client
(2) Start and stop NFS services
/etc/rc.d/init.d/portmap Start (Portmap is started by default in Redhat)
/etc/rc.d/init.d/nfs Start NFS Service
/etc/rc.d/init.d/nfs Stop Stop NFS Service
Note: If you modify the/etc/export file to add new shares, you should stop the NFS service before starting the NFS service to make the newly added share work. The same effect can be achieved using the command EXPORTFS-RV.
3, Linux client mount (Mount) NFS sharing for other Linux systems or UNIX systems
# Mkdir–p/mnt/nfs
Note: Create a directory to use as a mount point
#mount-t Nfs-o RW 10.140.133.9:/export/home/sunky/mnt/nfs
Note: Here we assume that 10.140.133.9 is the host IP address of the NFS server, of course, the host name can be used here, but the server-side IP definition must be added to the native/etc/hosts file. /export/home/sunky the directory that is shared with the server.
This allows the Linux client to access files that are shared on NFS by other Linux systems or UNIX systems via/MNT/NFS. These actions are tested in Redhat as Server 3, Redflag server4.1, SuSE Server 9, and Solaris 7, Solaris 8, Solaris 9 for X86&AMP;SPARC environments

Problems:

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/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 driveand floppy
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--bindOlddir 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--moveOlddir Newdir can be.
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/

Finished

"Reprint" Linux under the Mount command detailed;

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.