Mount Windows partitions in Ubuntu

Source: Internet
Author: User

1. Manual mounting

1) first, you need to know the name of Hard Disk Partition in Linux.

Sudo fdisk-l

Disk/dev/SDA: 160.0 GB, 160041885696 bytes
255 heads, 63 sectors/track, 19457 Cylinders
Units = cylinders of 16065*512 = 8225280 bytes
Disk identifier: 0xf0b1ebb0

Device boot start end blocks ID system
/Dev/sda1*1 2612 20980858 + 7 HPFs/NTFS
/Dev/sda2 2613 19457 135307462 + F w95 ext 'd (LBA)
/Dev/sda5 2613 6529 31463271 7 HPFs/NTFS
/Dev/sda6 11753 19457 61890381 7 HPFs/NTFS
/Dev/sda7 6530 6778 2000061 82 Linux swap/Solaris
/Dev/sda8 6779 11752 39953623 + 83 Linux

The main partitions are/dev/sda1 and/dev/sda2, while the remaining are logical partitions. /Dev/sda1 is a drive C in windows,/dev/sda5 is a drive D in windows, And/dev/sda6 is a drive F in Windows (my drive E is a drive ).

2) determine the locale of your Linux system (this locale includes the language and character encoding information used by the system ). Common locale in Chinese Linux is zh_cn.gb2312, zh_cn.gbk, zh_cn.gb18030 and zh_CN.UTF-8.

In the default installation, locale for Debian Linux and mandriva Linux is zh_cn.gb2312, while locale for Ubuntu Linux and Fedora Linux is a zh_CN.UTF-8. It is best not to change locale at will, otherwise there will be a lot of garbled characters. To view the locale of the system, run the following command on the terminal:

Echo $ Lang

3) You need to know the format of your windows partition. This can be seen in the partition attributes of windows, generally in FAT32 and NTFS formats.

Suppose your locale is a zh_CN.UTF-8, mount a Windows partition in FAT32 format of/dev/sda1 to the/mnt/C directory (if this directory does not exist, create a new sudo mkdir/mnt/C ), you can enter the following command in the terminal (SUDO must be added before this command in Ubuntu ):

Mount-T vfat/dev/sda1/mnt/c-o iocharset = utf8

If your locale is not a zh_CN.UTF-8, change the utf8 command above to gb2312; if the windows partition is in NTFS format, change the vfat command above to NTFS.

In this way, only root partitions in NTFS format can be read. If you want normal users to read partitions, you need to add the umask = 022 option, as shown below:

Mount-t ntfs/dev/sda1/mnt/c-o iocharset = utf8, umask = 022

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

4) it is much easier to detach a partition:

Umount/dev/sda1

When detaching a partition, the system prompts that the partition is busy (device is busy). You can use the following command to check which process is using this partition:

Fuser-Cu/dev/sda1

If the screen output is

/Dev/sda1: 8463 M (PCP)

You can use this command to view the program name of the process:

PS 8463

Then you can run this command to end the process:

Kill-9 8463

In this way, you can unmount the partition normally.

2. automatic mounting

To enable the Linux system to automatically mount Windows partitions at startup, you can write the preceding command to the/etc/fstab file. The following is an example:

# <File system> <mount point> <type> <Options> <dump> <pass>
Proc/proc defaults 0 0
#/Was on/dev/sda8 during installation
UUID = c75b08d0-5763-4754-a269-09e759b746da/ext4 errors = remount-ro 0 1
# Swap was on/dev/sda7 during installation
UUID = 86cd7015-66f4-4e91-bf36-f109818f8da4 none swap SW 0 0

/Dev/sda1/mnt/c ntfs utf8, umask = 022 0 0
/Dev/sda5/mnt/d NTFS utf8, umask = 022 0 0
/Dev/sda6/mnt/f ntfs utf8, umask = 022 0 0

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.