Linux fstab from a mounted windows partition by modifying the

Source: Internet
Author: User

My Computer installed Windows and Linux dual system, before Linux, to open the Windows system of C or D disk, always need to enter the password, very troublesome, and trouble for a long time.


Then one day, Hao brother saw, said can automatically mount the Windows partition when Linux boot, modify/etc/fstab This file, you can use the UUID of each partition. Later the headmaster also saw me every time the operation of trouble, said is really can engage, And he's done it. I think I've got to do it too.


The first is the man mount, which says that the UUID and label are more robust and robust. Brother Ho said that was right.


Mount also mentioned can refer to Fstab manual document, so after the man fstab found that the Fstab file is a multi-file system Information description file, the application can not modify it, Its maintenance and modification tasks need to be done by the system administrator. Each file system is represented as a row in Fstab, one row has multiple fields (field), and each field is separated by a space or TAB key. Let's look at each field and its meaning.


The six domains are called as follows:


<file system>     <mount point>     <type>     <options>     <dump> <pass>
<pre> This is an example of a two file system:
UUID=22B1037F-6C5E-46D0-B965-44CC42313795/EXT4 Errors=remount-ro 0 1
Uuid=7c4b5af9-599b-4052-aeb1-5dbd78f4d8e8/home EXT4 Defaults 0 2
</pre>
1.file System: Represents the name of the fast device that will be hung. Note that this device can also be a remote device, such as a device on a remote server, and I'll give you an example. For a local device, the domain format can be/dev/cdrom,label=&lt; label&gt;, or uuid=&lt;uuid&gt;; for remote file systems, in the format &lt;host&gt;:&lt;dir&gt; freeshell.ustc.edu.cn:/. Remote device format Good write, for the local device, how to get the UUID number and label it? to mount the/DEV/SDB1 or/dev/sda5? This can be viewed with the Blkid command:
<pre>sudo Blkid
/dev/sda1:label= "m-gm-3m-; m-gm-; M-^_m-dm-? M-^]m-gm-^um-^y "uuid=" 9ed61632d6160b63 "type=" NTFS "partuuid=" 5be4a3f9-01 "
/dev/sda2:uuid= "908265f98265e466" type= "NTFS" partuuid= "5be4a3f9-02"
/dev/sda3:uuid= "98b6fe61b6fe3ef6" type= "NTFS" partuuid= "5be4a3f9-03"
/dev/sda5:uuid= "7c4b5af9-599b-4052-aeb1-5dbd78f4d8e8" type= "Ext4" partuuid= "5be4a3f9-05"
/dev/sda6:uuid= "22b1037f-6c5e-46d0-b965-44cc42313795" type= "Ext4" partuuid= "5be4a3f9-06"
</pre>
We know that the partition format of the Windows system is NTFS (new technology file system), from the above output we can know that the Windows partition to mount is/dev/sda2 and/dev/ Sda3. Because these two partitions do not have a label, it is not possible to use label=&lt;label&gt; to represent the first domain. So we're going to mount two. The first domain of the Windows partition can be written like this:
<pre> #C盘
/dev/sda2
#D盘
/dev/sda3
</pre>
Or:
<pre> #C盘
uuid=908265f98265e466
#D盘
Uuid=98b6fe61b6fe3ef6
</pre>
The first field is written, and the second field looks like the next one.
2.mount point: That is, mount points, the students who used the mount command should understand what the domain is, and simply put the physical storage disk in the Linux system to find a point, the equivalent of a Linux file tree to find a point, The physical storage corresponds to this point. Mount at this point, all operations to that point are written to the corresponding physical storage. In the topmost mount example, we see uuid=22b1037f-6c5e-46d0-b965-44cc42313795 ( As can be seen from the Blkid command results, the physical storage of the partition is/DEV/SDA6 mounted to the/directory (Linux system root), that is, everything underneath the directory is written to the partition (except for the/home directory), and, similarly, all/ The contents of the home directory are written to Uuid=7c4b5af9-599b-4052-aeb1-5dbd78f4d8e8 (as can be seen from the blkid command result, the partition is/DEV/SDA5) in the partition.


So, where are we going to mount the C and D drives? I did it:
A. Before you manually mount the Windows partition without automatically mounting it, the system will mount the C and D drives, and the results are as follows:/media/wang (Wang is my user name), C drive is named 908265f98265e466, The D-Disk is named 98b6fe61b6fe3ef6, which is its corresponding UUID.
B. So I think it might be possible to mount any subdirectory under the/media directory,
So I set the domain to/MEDIA/C and/media/d, which combined the first two domains, should be written as:
<pre> #C盘
/dev/sda2/media/c
#D盘
/dev/sda3/media/d
</pre>
Or:
<pre> #C盘
Uuid=908265f98265e466/media/c
#D盘
uuid=98b6fe61b6fe3ef6/media/d
</pre>
Here's a third field type:


3.type is the format of the file system, such as commonly used under Linux ext,ext1,ext2,ext3,windows fat16,fat32,ntfs. You can write the field based on the results of the Blkid command. Based on the results of Blkid, The file system format for the C and D drives that we are going to mount is NTFS, so the first three domains are determined and have the following wording:
<pre> #C盘
/DEV/SDA2/MEDIA/C NTFS
#D盘
/dev/sda3/media/d NTFS
</pre>
Or:
<pre> #C盘
UUID=908265F98265E466/MEDIA/C NTFS
#D盘
uuid=98b6fe61b6fe3ef6/media/d NTFS
</pre>
4. The fourth field is option: options, which represent some options for mounting, with 6 options, each separated by commas, and the meanings of each option are explained in detail below:
<pre>default: Using Default options
Noauto: Ignores this record when executing mount-a (that is, mounting all file systems and executing this command on boot), which is not written in Fstab
User: Allow specific users to mount, such as User=bob, you can only allow Bob this user to mount
Owner: Allows the owner of the physical device to mount
Comment: Provides some instructions for the Fstab maintenance program
Nofail: After a mount failure, ignore this error and continue down execution
</pre>
Because we have no special requirements, so we choose the default, but nofail this option I will use, for the moment. So the first four fields can be written like this:
<pre> #C盘
/DEV/SDA2/MEDIA/C NTFS Default
#D盘
/dev/sda3/media/d NTFS Default
</pre>
Or:
<pre> #C盘
UUID=908265F98265E466/MEDIA/C NTFS Default
#D盘
uuid=98b6fe61b6fe3ef6/media/d NTFS Default
</pre>
5. The 5th domain is dump,dump This command performs a backup operation, which is 0, which indicates that the partition is ignored when the dump operation is performed, and if 1, the partition is also backed up when the dump is executed. Because we don't have the backup requirement, the domain is set to 0, so the first five domains are:
<pre> #C盘
/DEV/SDA2/MEDIA/C NTFS default 0
#D盘
/dev/sda3/media/d NTFS default 0
</pre>
Or:
<pre> #C盘
UUID=908265F98265E466/MEDIA/C NTFS default 0
#D盘
uuid=98b6fe61b6fe3ef6/media/d NTFS default 0
</pre>
6. The last domain is pass, not the pass of the passwd, but the check order of the partition when the system restarts to check if the partition is normal or not. The Passno of the file system where the root directory resides is 1, and the other file partitions are 2. If set to 0, is not checked. Our C and D disks do not want Linux to check, so set to 0.
So by combining the above steps, we can write the following complete two records:
<pre> #C盘
/DEV/SDA2/MEDIA/C NTFS default 0 0
#D盘
/dev/sda3/media/d NTFS default 0 0
</pre>
Or:
<pre> #C盘
UUID=908265F98265E466/MEDIA/C NTFS default 0 0
#D盘
uuid=98b6fe61b6fe3ef6/media/d NTFS default 0 0
</pre>
Arguably both forms are possible, add any form of two records to the Fstab file, restart the system, the next time you open the Windows system partition, you should not need to enter a password.

Linux fstab from a mounted windows partition by modifying the

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.