A dual-system is installed on a computer, and sometimes Windows resources are used in Linux. Therefore, you need to automatically mount windows partitions when Linux is started. The method is relatively simple, that is, to modify the/etc/fstab file! First, we will introduce the/etc/fstab file format. The/etc/fstab file configures mounting options for all file systems and disk devices. For each file system and the dual system installed on the computer, Linux sometimes needs to use Windows resources, so we hope to automatically mount windows partitions at Linux startup. The method is relatively simple, that is, to modify the/etc/fstab file!
First, we will introduce the/etc/fstab file format.
The/etc/fstab file configures mounting options for all file systems and disk devices. Each file system and disk device have independent lines. each option in the row is separated by spaces or tabs. The format of each line is as follows:
Fs_spec [tab] fs_file [tab] fs_type [tab] fs_option [tab] fs_dump [tab] fs_pass
1 fs_spec -- this field defines the device or remote file system where the file system to be loaded is located.
2fs_file -- file system loading point. This field is none for the swap device. if the directory name contains spaces, 40 is used to indicate spaces.
3 fs_type -- defines the file system type
4 fs_option -- specify the specific parameter options used to load the file system of the device. multiple parameters are separated by commas.
Ro -- load the file system in read-only mode
Sync-do not buffer the write operations on the device, which can prevent file system damage during abnormal shutdown, but reduce the computer speed.
User-promised normal users to load the file system
Quota-force disk quota limit on the file system
Noauto -- no longer use mount-a (for example, when the system starts) to load the file system
5 fs_dump -- this option is used by the "dump" command to check how often a file system should be dumped. If no dump is required, it is set to 0.
6fs_pass -- this field is used by the fsck command to determine the sequence of the file system to be scanned at startup. The value of the corresponding field for the root file system "/" should be 1, other file systems should be 2. If the file system does not need to scan at startup, set this field to 0.
It is easy to define the format. Perform the following operations with root permissions:
(1) create a mount point
# Mkdir/mnt/windows
(2) find the file system partition to be mounted
#/Sbin/fdisk-l
Find what you need to do? Partition location ......
(3) modify the/etc/fstab file
# Vim/etc/fstab
Add a row:
(Partition location) for example:/dev/sda8 [tab]/mnt/windows [tab] vfat [tab] auto, umask = 0 [tab] 0 [tab] 0
Save the file and exit vim.
(4) restart test
# Reboot
...
# Ls/mnt/windows
If the contents in the directory are displayed, the mounting is successful.
If Chinese characters cannot be displayed after mounting, that is, Chinese characters have been replaced, change:
/Dev/sda8 [tab]/mnt/windows [tab] vfat [tab] auto, umask = 0, iocharset = cp936, codepage = 936 [tab] 0 [tab] 0
[Tab] indicates space or click "tab"