Mount Windows partition method under Linux system

Source: Internet
Author: User
Tags file system locale linux

Mount Windows partitions

1. Manual Mount

Windows partitions can also be read in Linux, including the FAT32 format and NTFS format. First, you need to know the name of the hard disk partition under Linux. For example, the C disk under Windows is usually the Hda1,d disk is the hda5,e disk is Hda6, and so on. For more information, see the documentation.

To mount a Windows partition, first determine the locale of the Linux system you are using (this locale includes information such as the language and character encoding used by the system). The commonly used locale in Chinese Linux are zh_cn.gb2312,zh_cn.gbk,zh_cn.gb18030 and ZH_CN. UTF-8.

In the default installation, the locale of Debian Linux and Mandriva Linux is zh_cn.gb2312, while the locale of Ubuntu Linux and Fedora Linux is ZH_CN. UTF-8. It is best not to change locale, otherwise there will be a lot of garbled cases. To view the locale of the system, you can enter the following command under the terminal to view:

Echo $lang

Second, you need to know the format of your Windows partition, as you can see in the Windows Partition's properties, which are generally FAT32 and NTFS-formatted.

Let's say your locale is ZH_CN. UTF-8, to mount a/DEV/HDA1 FAT32-formatted Windows partition to the/MNT/C directory (if the directory does not exist manually create a new one), you can enter the following command under the terminal (in Ubuntu also need to add sudo before this line):

Mount-t vfat/dev/hda1/mnt/c-O Iocharset=utf8

If your locale is not ZH_CN. UTF-8, change the UTF8 of the above command to gb2312; if the Windows partition is in NTFS format, change the vfat of the above command to NTFS.

This mounted NTFS-formatted partition, which can only be read by root, and if required for ordinary users to read, requires the addition of the umask=022 option, as follows:

Mount-t ntfs/dev/hda1/mnt/c-O iocharset=utf8,umask=022

Similarly, if you want to allow all users to read and modify the mounted partitions, you can change the umask=022 above to umask=0.

Uninstalling a partition is much simpler:

Umount/dev/hda1

Sometimes when you uninstall a partition, the prompt partition is busy (device is busy), you can use the following command to see which process is using this partition:

Fuser-cu/dev/hda1

If the output of the screen is

/dev/hda1:8463m (CCK)

You can use this command to see the program name for this process:

PS 8463

You can then end this process with this command:

Kill-9 8463

This will allow you to uninstall the partitions properly.

2. Automatic mount

To automatically mount the Windows partition when the Linux system starts up, you can write the above command to the/etc/fstab file, and here is an example:

# /etc/fstab: static file system information.
#
#[file system] [mount point] [type] [options] [dump] [pass]
proc /proc proc defaults 0 0
/dev/hda9 / ext3 defaults 0 1
/dev/hda13 none swap sw 0 0
/dev/hdc /media/cdrom iso9660 ro,user,noauto 0 0
/dev/fd0 /media/floppy auto rw,user,noauto 0 0
/dev/hda10 /mnt/debian ext3 defaults 0 0
/dev/hda1 /mnt/C ntfs utf8,umask=022 0 0
/dev/hda5 /mnt/D vfat utf8,umask=0 0 0

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.