How to automatically mount Windows partitions and read/write NTFS partitions in Ubuntu

Source: Internet
Author: User
Etc/fstab description:/dev/hdbx is the partition in windows to be mounted. Note that my partition is hdb, you may also be using hda, where/mnt/winx is the directory to be mounted. here I will use it to Mount CDE disks for windows respectively. Vfat indicates the fat32 file format. ntfs indicates utf8 after ntfs format. umask indicates the permission of the file directory. In short Etc/fstab

Note:/dev/hdbx is the partition under windows to be mounted. Note that I am using hdb, you may also be using hda, where/mnt/winx is the directory to be mounted. here I use it to mount the windows C D edisk. Vfat indicates the fat32 file format. ntfs indicates utf8 after ntfs format. umask indicates the permission of the file directory. In short, there are three 0 s, and the latter two are both 0.

Ubuntu automatically mounts windows partitions and reads and writes NTFS partitions.

(1)

Run the following command to edit the Mount script autowinfs.

Copy and paste the following reference content,
Save the file and exit.


#! /Bin/sh
#
# Autowinfs auto mount windows disks
#
# Copyright (c) 2005 Jiahua Huang
# License: GPLv2
#
#/Usr/bin/sutowinfs
# It is used to automatically mount Windows partitions on the machine and write to/etc/fstab
# February 18 14:06:12 CST 2005
Mkdir-p/windows/
Rmdir/windows/* 1>/dev/null
Grep-v '/windows/'/etc/fstab>/etc/fstab. swp
# This script is used in the Locale of the UTF-8
# It is rare that a separate fdisk-l cannot list partitions, so remove/dev/[hs] d [a-z ].
# Fdisk-l/dev/[hs] d [a-z] | grep-E 'fat | NTFS '| cut-D'-f1 | cut-d /- f3 | while read WDISKS
# Look for NTFS partitions. The auto of the new kernel seems to be a problem, so now we separate NTFS and VFST.
Fdisk-l/dev/[hs] d [a-z] | grep 'ntfs '| cut-D'-f1 | cut-d/-f3 | while read WDISKS
Do echo "/dev/$ WDISKS/windows/$ WDISKS ntfs auto, user, nls = utf8, umask = 0 0 0">/etc/fstab. swp
Mkdir "/windows/$ WDISKS"
Done
Fdisk-l/dev/[hs] d [a-z] | grep 'fat' | cut-D'-f1 | cut-d/-f3 | while read WDISKS
Do echo "/dev/$ WDISKS/windows/$ WDISKS vfat auto, user, utf8, umask = 0 0 0">/etc/fstab. swp
Mkdir "/windows/$ WDISKS"
Done
Mv/etc/fstab. swp/etc/fstab
Mount-
Exit 0


Run the following command:

The Windows partition will be mounted under/windows.

(2)

In actual use, the utf8 character set works very well without garbled characters.
Mount-t vfat/dev/hda2/mnt/d-o codepage = 936, iocharset = utf8

My fstab
#/Etc/fstab: static file system information.
#
#
Proc/proc defaults 0 0
/Dev/hdc8/ext3 defaults, errors = remount-ro0 1
/Dev/hdc9 none swap sw 0 0
/Dev/hdb/media/cdrom0 udf, iso9660user, noauto 0 0 0
/Dev/hdc1/mnt/winc vfat defaults, codepage = 936, iocharset = utf8 0 0
/Dev/hdc5/mnt/wind ntfs ULTS ults, iocharset = utf8, umask = 0222 0 0
/Dev/hdc6/mnt/wine ntfs ULTS ults, iocharset = utf8, umask = 0222 0 0
/Dev/hdc7/mnt/winf vfat defaults, codepage = 936, iocharset = utf8 0 0

(Below

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.