Use fstab to automatically mount the FAT and NTFS partitions of Win in linux.

Source: Internet
Author: User
Use fstab to automatically mount the FAT and NTFS partitions of Win in linux-general Linux technology-Linux technology and application information. For more information, see the following. Author: felonwan

This is a section of the page written on archLinux wiki Based on the NTFS partition mounted on your computer and the online information.

For a better understanding of fstab usage, refer to the page:

Http://wiki.archlinux.org/index.php/Fstab_ (% E7 % AE % 80% E4 % BD % 93% E4 % B8 % AD % E6 % 96% 87 )#. e7.94.A8fstab. e8.87.AA. e5.8A. a8.E6.8C. 82. e8.BD. BDFAT32.E5.92.8CNTFS. e5.88.86.E5.8C. BA

The procedure is as follows:

1. first obtain the hard disk information table using fdisk-l (which may require root permission), for example:

# Device Boot Start End Blocks Id System
/Dev/sda1*1 2397 19253871 B W95 FAT32
/Dev/sda2 2398 3144 6000277 + 83 Linux
/Dev/sda3 3145 9729 52894012 + 5 Extended
/Dev/sda5 3145 3152 64228 + 83 Linux
/Dev/sda6 3153 3276 995998 + 82 Linux swap/Solaris
/Dev/sda7 3277 7340 32644048 + 83 Linux
/Dev/sda8 7341 9729 19189611 7 HPFS/NTFS

From the above, we know that there is only one hard disk on this computer. The partition sda1 is in fat32 format, sda8 is in NTFS format, and sda1 is able to be started, so it may be the disk of the Windows system. The system disk is mounted in read-only mode, and the non-system disk sda8 is mounted in read/write mode (it cannot be mounted in any directory "/" or below ).

2. Use your favorite editor to open/etc/fstab in the terminal, for example:

Nano/etc/fstab

Add the following content to the end of the file:

/Dev/sda1/home/username/WindowsC vfat defaults, iocharset = cp936, umask = 022, nls = gb2312 0 0/dev/sda8/home/username/WindowsD ntfs defaults, iocharset = utf8, umask = 000, nls = utf8 0 0

Save and exit.

3. Enter

Mount-

You should be able to find the content of your system partition sda1 under/home/username/WindowsC, and find the content of sda8 in/home/username/WindowsD (username indicates the user name ).

All of my win partitions are ntfs. I tested ntfs partitions:

No Chinese garbled characters are available when nls = utf8 is used!

Iocharset = utf8 is used only, and garbled characters are displayed!

WindowsC can only perform read operations with umask = 022. After using, it can perform normal read and write, and WindowsD can perform normal file read and write.

Note: I have mounted all partitions to the "/home" sub-directory. If the sub-directory is "/", umask = 000 cannot be written, this is a problem with the Linux system's "File System" permissions. For double insurance, you can mount win's system partition, drive C, under "/" and Its subdirectories. But if you want to write a file, you 'd better put it under/home.

Here, nls is used for mounting fat32, and codepage and iocharset are used on the Internet. I don't know if nls can be used! (Haha, fake taste)
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.