Summary of mounting a file system in Linux

Source: Internet
Author: User
Article Title: Summary of mounting a file system in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

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 used like in a common Linux ext file system. There were not many built-in file systems supported in Linux in the early days. Since kernel 2.0.x, VFAT is supported and will be gradually increased in the future. It can be said that most file systems have support. Only the kernel needs to be re-compiled to support NTFS.

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. The file system type of the root partition 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. For example, I installed Linux and Windows on my machine at the same time. Windows C adopts the NTFS file system and D adopts the FAT32 file system. When I work on Linux, I often need to access the Windows drive C and drive D, or even the shared directory on the network, in Linux, the mount command is used to mount a file system. The man mount command can be used to get a detailed explanation of the command parameters. The following describes how to mount a file system using the command line in several cases:

1. Add the FAT32 File System

Simplest usage

Mount/dev/hda6/mnt/d

/Dev/hda6 is the author's Windows d disk,/mnt/d is the 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 ). After the core supports NTFS, run the following command:

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 file system on the USB flash disk.

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 smbfs type. When mounting a samba shared partition, Chinese file names and directory names may also be garbled. You can run the following command to mount the file:

Mount-t smbfs-o

Username = terry, password = terry, codepage = 936, iocharset = cp936

// Terry-linux/terry/mp3/

Mount-t smbfs-o

Username = terry, password = terry, codepage = 936, iocharset = cp936

// 192.168.100.228/terry/mp3/

Note: you do not need to directly write the password = terry parameter. In the system field, you will need to enter the password to prevent anyone from directly viewing your password. Depending on the actual situation, the parameters following-o can be increased or decreased accordingly.

[1] [2] Next page

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.