Two Methods for automatically mounting Windows partitions when Linux is started

Source: Internet
Author: User
Article Title: Two Methods for automatically mounting Windows partitions when Linux is started. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Linux users will certainly not be unfamiliar with the content discussed in this article. In Linux, partitions in Windows file systems are usually not automatically mounted on startup. In Ubuntu, You need to click the Windows partition to mount the disk. In Fedora, you even need to enter the root password.

I have summarized two methods for automatic mounting of Windows partitions.

First, use the fstab file:

First, you must understand the device code of the Windows partition. The current hard disk of a computer is usually a SCSI hard disk. Here we assume that Windows is installed on drive C, and drive C is D and drive E, in the Windows File System, the device file of drive C in Linux is/dev/sda1, drive D is/dev/sda5, and drive E is dev/sda6. They are automatically mounted to the/media/C,/media/D, and/media/E directories respectively.

Create a mount directory:

1 mkdir/media/C

2 mkdir/media/D

3 mkdir/media/E

Use vi to open the/etc/fstab file, for example:

Append the following content to the end (1 \ 2 \ 3 is the row number, do not include ):

1/dev/sda1/media/C ntfs defaults 0 1

2/dev/sda5/media/D ntfs defaults 0 1

3/dev/sda6/media/E ntfs defaults 0 1

The first part is/dev/sda1, that is, the device, that is, the Windows partition. The second part is the mount point. The third part is the file system format of the Windows partition. If it is a Fat file system, here we need to change it to vfat. The fourth part is some parameters. defaults includes auto (auto indicates automatic mounting), the fifth part indicates backup, and the sixth part indicates performing fsck indicates hard disk check.

Save the file and run:

Mount-

Check whether an error is written. Note that if an error is written, the system cannot start up! Then save and restart the machine and it will be automatically mounted. .

Second, run the script at startup:

The/etc directory contains a series of scripts automatically executed at startup, so you only need to add the mount command to it to achieve automatic mounting, which is effective in the Ubuntu test.

First, create the corresponding directory under/media, and then use vi or Gedit to open/etc/rc. local file. Add the following content (remove the row number) after it (exit 0 in Ubuntu, you need to add it to the beginning ):

1 mount-t ntfs/dev/sda1/media/C

2 mount-t ntfs/dev/sda5/media/D

3 mount-t ntfs/dev/sda6/media/E

Save the file and automatically mount it when you restart the machine.

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.