Garbled characters in linuxmountwindows [summary]

Source: Internet
Author: User
When learning about the operating system, we all know that the file system is an important part of the operating system. There are many types of file systems, such as windows fat, fat32, Linux ext, ext2 or ext3, and FreeBSD ufs. In the process of using Linux, the Linux operating system often uses the virtual file system (VFS ).

When learning about the operating system, we all know that the file system is an important part of the operating system. There are many types of file systems, such as windows fat, fat32, Linux ext, ext2 or ext3, and FreeBSD ufs.
During the use of Linux, the Linux operating system often uses the virtual file system (VFS) to directly access various file systems that have been supported by the kernel through VFS, it is like using an ordinary Linux ext series file system.
Unified sample.
There were not many built-in file systems supported in Linux in the early days. since kernel 2.0.x, VFAT was supported and will be gradually increased in the future. it can be said that most file systems have support. Only some NTFS instances need to be reinstalled.
Only the kernel can be compiled.
During Linux startup, the file system on each partition is mounted to the corresponding loading point according to the settings in/etc/fstab. Linux requires at least two partitions to start: one is the root partition/and the other is the swap
Partition. if the root partition fails to be loaded at startup, Linux cannot start. If the swap partition fails to be loaded, Linux cannot be started, and the speed will be greatly affected if the memory is insufficient. Root partition file system
The type is usually ext, ext2, or ext3, but it can also be other file systems.
In addition to the file system required for Linux, Linux users often need to use other file systems, especially when multiple operating systems are installed on one machine at the same time. While working on Linux,
You often need to access the content of drive C and drive D in Windows, or even the shared directory on the network. mount a file system in Linux using the mount command, you can use the man mount command to get detailed explanations of command parameters. Next
To introduce how to mount a file system using the command line in several cases:
1. add the FAT32 file system
Simplest usage
Fdisk-l
View hard disk partition information
Mount/dev/hda6/mnt/d
/Dev/hda6 is a Windows d disk and/mnt/d is a directory mount point. Linux recognizes the type of the file system in the/dev/hda6 partition, and then adds it. Of course, you can also specify the file system type of the partition. the command is as follows:
Mount-t vfat/dev/hda6/mnt/d
In practice, a windows partition is directly attached, and the Chinese file name and directory name are garbled. to avoid this problem, you can specify a character set by running the following command:
Mount/dev/hda6/mnt/d-o codepage = 936, iocharset = cp936
Mount-t vfat/dev/hda6/mnt/d-o codepage = 936, iocharset = cp936
Note: cp936 refers to simplified Chinese and cp950 refers to traditional Chinese.
2. mount the NTFS file system
In most Linux versions, you need to re-compile the Linux core to mount the NTFS partition (see other articles for the compilation method ). (Supplement: install the rpm Package that supports NTFS.) after the core supports NTFS, you can use the following
Command mounting:
Mount-t ntfs/dev/hda2/mnt/c
You can also specify the character set for garbled characters in Chinese file names and directory names. However, unlike the vfat partition, the following command is practical:
Mount-t ntfs-o iocharset = cp936/dev/hda2/mnt/c-r
Mount-t ntfs-o iocharset = cp936, rw/dev/hda2/mnt/c
3. mount the file system on the USB flash drive
More and more people are using USB flash drives. In fact, using USB flash drives in Linux is also very simple. Linux has good support for USB devices. after you insert a USB flash drive, the USB flash disk is recognized as a SCSI disk. you can use the following command to mount the USB flash disk.
File system on
Mount/dev/sda1/usb
You can specify a character set for garbled characters in Chinese file names and directory names. the command is similar to the one described in FAT32:
Mount/dev/sda1/usb-o pagecode = 936, iocharset = cp936
4. add a Linux directory shared by samba.
The directory shared by samba is hard to tell which file system it was originally, but this is not important as long as it is transparent to users. When mounting, we specify the type as smbfs and mount the samba shared partition.
The Chinese file name and directory name may also be garbled. you can use the following command to mount it:
Mount-t smbfs-o
Username = windows, password = samba, codepage = 936, iocharset = cp936
// Windows/samba/mp3/
Mount-t smbfs-o
Username = windows, password = samba, codepage = 936, iocharset = cp936
// 192.168.0.32/samba/mnt/windows/
Note: You do not need to directly write the password = samba parameter. in the system field, you need to enter a password to prevent anyone from directly viewing your password. Depending on the actual situation, the parameters following-o can be increased or decreased accordingly.
5. add the directory shared by the Window system
In the LAN, you often need to access the directories shared by other Windows systems. in Linux, after samba is installed, you can use the commands in samba to access the shared resources of Windows machines.
Use smbclient to list shared resources of Windows machines
Smbclient-L 192.168.0.32
Based on the Windows shared resources listed above, you can select the Windows shared resources to be attached to the local Linux, and then use smbmount or mount to add the resources. refer to the following commands:
Smbmount // 192.168.0.32/samba/mnt/windows/
Mount // 192.168.0.32/g/mnt/cdrom-o username = windows (enter the password on the command line)
Mount // 192.168.0.32/g/mnt/cdrom-o username = windows $ samba (you do not need to enter the password on the command line)
Note: in addition to the command line method described above, the best method is to use other clients, such as LinNeighborhood, networkneighbours, and ksmbshare. please refer to other articles.
The above is a command line method. you must enter the command once each time you use it. if you often need to mount some file systems, what should you do if you want to automatically mount them at startup? The following two methods are described:
Method 1.
Place the mounting command in/etc/rc. d/rc. local.
Method 2.
Modify the partition configuration file/etc/fstab and mount the file system at startup. The following is my/etc/fstab file:
LABEL = // ext3 defaults 1 1
None/dev/pts devpts gid = 5, mode = 620 0 0
LABEL =/home ext3 defaults 1 2
None/proc defaults 0 0
None/dev/shm tmpfs defaults 0 0
/Dev/hda4 swap swapdefaults 0 0
/Dev/cdrom/mnt/cdrom iso9660 noauto, owner, kudzu, ro 0 0
/Dev/hda2/ntfs ntfsdefaults, iocharset = cp9360 0
/Dev/hda6/win vfatdefaults, codepage = 936, iocharset = cp9360 0
// 192.168.0.32/samba/windows smbfs username = terry, password = terry, codepage = cp936, iocharset = cp936 0 0
Note the last three lines:
The fourth to last line adds a C drive, NTFS format
In the last row, mount the D disk, in FAT32 format.
In the penultimate line, a directory is mounted to another Linux file server on which samba is installed in the LAN.
This article summarizes several common methods for mounting a file system in Linux under different circumstances, including how to mount FAT/NTFS/smbfs/U disk, and solve the problem of Chinese Display/user password in mounting.

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.