Linux accesses Windows partitions FAT32 and NTFS

Source: Internet
Author: User
Article Title: Linux accesses Windows partitions FAT32 and NTFS. 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.

The Linux kernel supports reading and writing Fat, NTFS, Vfat, Fat32, Hfs, and other file systems (at least read). Therefore, Windows is more accessible in Linux than Linux, you can directly use Linux commands without using special software.

Linux accesses Windows partitions in Fat/Fat32 partitions

Linux regards all devices in the system as files, so it is very convenient to access Windows partitions in Linux. You only need to use the mount command to mount Windows partitions into a folder in Linux.

The format of the mount command is (you must log on as the root user ):

Mount [-afFhnrvVm] [-| <标签> ] [-O <选项> ] [-T <文件系统> ] [Device name] [mount point]

To mount a partition (such as a drive D) in Windows to the/mnt/win directory in Linux, create a win folder in/mnt, start the Console terminal mode, enter the command "mount/dev/hda5/mnt/win", and then enter the/mnt/win directory. Then you can see the content of drive D in Windows.

Some may ask, why do you need to enter the above command, especially what is/dev/hda5? This is a representation of partitions in Linux. in Linux, the Windows partition is generally: hda1 is drive C, hda5 is drive D, hda6 is drive E, and so on...

However, after using the above method to load Windows partitions, another troublesome thing is that all Chinese file names and folder names in Windows are displayed as question marks, but English is displayed normally, this computer also has ethnic discrimination! To combat this type of discrimination, we must make full use of our weapons and add some parameters to the mount command to make it correctly display Chinese characters. In this case, you only need to change the above command to "mount-t vfat-o iocharset = cp936/dev/hda5/mnt/win" and run it.

When this partition is loaded, we can also detach it when it is not in use, and the command for detaching is umoun. If you detach the partition, just enter "umount/mnt/win.

In addition, we can also enable Linux to automatically load partitions at startup, so that you do not have to input commands to load partitions every time you use Windows partitions.

First, Log On As A root user. after entering the graphic interface, find the fstab file under the/etc directory in the File Manager of Linux, right-click and choose a text editing software to open the file, add the command "/dev/hda5/mnt/win vfat codepage = 936, iocharset = cp936 1 1" at the bottom of the content, and create the win folder under the/mnt directory, after the computer is restarted, access the/mnt/win Directory, which is the content of the Windows partition. You can also load multiple partitions using this method, and you can also use the vi editor in the command line mode during editing.

Linux accesses Windows partitions during NTFS partitioning.

If you use Mandrake or red-flag Linux and the hard disk already has NTFS partitions during installation, you can access the hard disk NTFS partition without re-compiling the kernel after installation; if there is no NTFS partition in the hard disk during installation, or the RedHat Linux is used, you must re-compile the kernel and add the NTFS module to access the NTFS partition normally.

First, log on to the root user, and then insert the second installation disk of RedHat Linux into the optical drive, find the kernel-source-2.4.xx-x.i386.rpm in the/redhat/RPMS directory (here x represents a number) file, if the graphic interface, double-click the installation directly. If it is a command line, enter the rpm-ivh kernel-source-2.4.xx-x.i386.rpm command.

And then enter the/usr/src/linux-2.4.xx-x/configs directory, here there are many need to compile the kernel cultivation file, generally choose "kernel-source-2.4.xx-x.i686.config. Copy the file to the/usr/src/linux2.4.xx-x Directory, open it in a text editor, and change the line "# CONFIG_NTFS_FS is not set" to "CONFIG_NTFS_FS = m ".

In terminal mode, enter the/usr/src/linux-2.4.xx-3 directory, run the "make modules" command to compile the desired NTFS module, in the compilation process do not need to care about the NTFS module, in the compilation process does not need to care about the content irrelevant to NTFS, after the compilation is complete, in the/usr/src/linux-2.4.xx-x/fs/ntf directory can find a ntfs. o file, copy it to the/lib/modules/2.4.xx-x/kernel/fs directory, then return to the/usr/src/linux-2.4.xx-3 directory, enter the command:

       
          #depmod  #modprobe ntfs
       

The remaining work is the same as that in the previous Fat/Fat32 partition when Linux accesses the Windows partition.

The latest ntfs partition access method for linux

[Declaration] This article is for reference: Mr. Liu junmin's article "modules required for quick compilation of Linux", because this article is too old, A veteran may be able to use it after a change, but it is not suitable for beginners.

[Thank you] Thank you, Mr. Liu junmin.

[Problem] This method cannot write data to a disk in ntfs format. If you have any questions, you can send an email to Mr. Liu. His email is fancao0515@0451.com.

[Operating environment]

RedHat7.2 (Engma); Kernel 2.4.7-10

[Body]

1. Under the/usr/src/linux-2.4.7-10/configs directory, there are several configurations used to compile the kernel. Choose the configuration we want, if your machine is i686, you have to choose kernel-2.4.7-i686.config,

And copy it to the/usr/src/linux-2.4.7-10 directory, renamed. config.

[Note] If your machine is another one, you have to select the appropriate one. This can be seen when you shut down or when you start the machine. When you shut down an i686 instance, choose i686. If it is i386, you should choose i386, and so on. Because I still don't know how to select the corresponding file, I am using this stupid method. If you do not know

Use this method. Ha ..........

2. Modify the. config file, remove unnecessary modules, and add the desired modules.

Open. config, there are many XXXX = m items, these are to be compiled as module items, because we do not want to compile these modules, so we need to remove all XXXX = m items. And then add the modules we want

# Change CONFIG_NTFS_FS is not set

CONFIG_NTFS_FS = m

CONFIG_NTFS_RW = m

[Note] Remember to remove #. This step can be modified by the editor. Of course, you can use tools you are familiar with to do this.

3. Compile the NTFS module.

Run the command in the/usr/src/linux-2.4.7-10 directory to compile the NTFS module we want.

# Make modules

Note: Do not run the command make modules_install. Otherwise, it will cause serious consequences and delete all modules in your system.

4. Install the NTFS module.

The ntfs. o obtained after compilation is under the/usr/src/linux-2.4.7-10/fs/ntfs directory, manually copy it to the/lib/modules/2.4.7-10/kernel/fs directory.

5. Load the NTFS module;

In the directory/usr/src/linux2.4.7-10, run the following command:

# Depmod

# Modprobe nfts

6. Modify the/etc/fstab file. You have to use the configuration method on my machine. Add the file as follows, in this way, the machine can load partitions at startup.

/Dev/hdc1/mnt/WinC ntfs iocharset = cp936 0 0

/Dev/hdc5/mnt/WinD ntfs iocharset = cp936 0 0

/Dev/hdc6/mnt/WinE ntfs iocharset = cp936 0 0

/Dev/hdc7/mnt/WinF ntfs iocharset = cp936 0 0

7. Create a folder under the/mnt/directory: Create a folder in/mnt. The folder must be the same as the loaded partition. Take my machine as an example.

WinC

WinD

WinE

WinF

[Note] case sensitive.

8. Restart the machine. If there are no partitions to be loaded on the desktop, you can do the same as the hard disk icon as follows;

Right-click the blank area of the desktop under KDE and choose [new]-> [Hard Disk]->

In [general], obtain the name corresponding to the attached hard disk. Then select the partition you want to load in [device.

9. If you do not want to attach it to the desktop, you can directly access your ntfs-format disk under/mnt.

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.