Linux boot automatically mount NTFS partition for writable

Source: Internet
Author: User
Tags locale mkdir file permissions

After you upgrade to OpenSUSE 13.2, Windows NTFS partitions that were originally configured to mount and write automatically are now not mounted automatically, and automatic mounts are configured in Disk Management and the Mount read-only is not checked for direct writing. And toss for a long time according to the ridge from the Maple finishing blog to understand.

To use Windows partitions in a Linux system on a Windows + Linux dual system, you need to mount the Windows partition to the Linux system first. Mount can be done at the command line when needed, and can be automatically mounted at each boot in the management control center, such as OpenSUSE's YaST.

The following assumes that the C and D two partitions in Windows are in the NTFS format and are mounted separately in the/winc and/wind two directories in the Linux system (here, for example, OpenSUSE 13.2). and assume that the current Linux average user is linuxuser.

0. Preparatory work

The preparation is simple, which is to ensure that there are two directories in Linux that we need to mount, and that Linuxuser have read and write access to them.

Create a directory,

# sudo mkdir/winc
# sudo mkdir/wind

Change owner to Linuxuser, user group to users,

# chown Linuxuser:users/winc
# chown Linuxuser:users/wind

Also know where the two partitions in Windows are located in Linux (Access paths), and here are their device paths, respectively,

/dev/sda1
/dev/sda5

If you do not know, you can view it through a command-line directive (requires root permissions).

# sudo fdisk-l

DISK/DEV/SDA: ...

Device Boot Start End sectors Size Id Type

/dev/sda1 ... Hpfs/ntfs/exfat
/dev/sda2 * ... Extended
/dev/sda5 ... Hpfs/ntfs/exfat
/dev/sda6 ...
/dev/sda7 ...
/dev/sda8 ...

Some unnecessary information is omitted here.

1. Command-line Operations ¶

Root permissions are also required.

Mounted,

Mount/dev/sda1/winc
Mount/dev/sda5/wind

This is a straightforward way to write. But every time the shutdown is gone.

Cancel the Mount,

Umount/winc
Umount/wind

2. Graphical interface operation + Power on Mount automatically

or the graphical interface to look pleasing to the eye, and set up automatic mounting is also convenient. Root permissions are also required.

Yast–> system–> partitioner, click Yes to confirm the warning;

Right-click a Windows NTFS partition, such as C partition (/DEV/SDA1), and select Edit;
Enter/winc in mount point in Mount Partition;
Click the Fstab Options below to open the Settings page, just tick a mountable by User,

This is a step that differs from the previous command line, which can also be manipulated by the command line, which is to modify the/etc/fstab file directly, as in

<partition> <mount point> ntfs-3g <options> 0 0

For example

/dev/sda5/wind ntfs-3g User,users,gid=users,fmask=002,dmask=002,locale=en_us. UTF-8 0 0
/dev/sda1/winc ntfs-3g User,users,gid=users,fmask=133,dmask=022,locale=en_us. UTF-8 0 0
Click OK to save Fstab options settings;

Click Finish to save the/dev/sda1 settings.

You can also set up the D partition. However, these partitions cannot be written to only by the above settings, although the "Mount read-only" above is not checked. If you want to make it writable, you also need to modify the arbitrary option Value (which is actually the ntfs-3g option argument) in the line below in the previous illustration.

Users,gid=users,fmask=133,dmask=022,locale=en_us. UTF-8

The key is the Fmask (file permissions) and Dmask (directory permissions), instead,

Users,gid=users,fmask=002,dmask=002,locale=en_us. UTF-8

Where locale is used to set up the Chinese environment to display Chinese, can be changed to LOCALE=ZH_CN. UTF-8.

The settings here need to be restarted for the computer to take effect.

It is recommended that you do not perform writable settings on the system disk for the security and stability of your Windows system.

3. Notes

Typical ntfs-3g options:

users– if the ntfs-3g executable set SUID root (command: chmod u+s/bin/ntfs-3g), anyone is allowed to mount/uninstall the NTFS partition. Note To use users instead of user
Do not mount partitions automatically when noauto– start
uid– Specifies the owner of files and directories in an NTFS partition (in decimal notation)
gid– A user group that specifies files and directories in an NTFS partition (in decimal notation)
fmask– file permissions (octal number Mask)
dmask– Directory permissions (octal number Mask)
locale– is typically used to make files that use internationalized character sets visible
Masked code:

Can be set by umask

The File/folder property corresponding to mask 002 is 775,775 permissions for Ug:rwx,o:rx

u/g/o = User/group/everybody
r/w/x = Read/write/execute
Read 4– allow reading of files
Write 2– allow writing/modifying files
EXecute read/write/delete/modify/directory

The simple point of the relationship is 002+775=777, the maximum privilege is 777, means that anyone can perform 1, write 2, read 4,1+2+4=7
113 corresponds to 664.

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.