source: chapter10/fstab.xml@ 0ea3431

xry111/clfs-ng
Last change on this file since 0ea3431 was 0ea3431, checked in by Xi Ruoyao <xry111@…>, 2 years ago

Merge remote-tracking branch 'origin/trunk' into xry111/clfs-ng

  • Property mode set to 100644
File size: 5.7 KB
Line 
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
4 <!ENTITY % general-entities SYSTEM "../general.ent">
5 %general-entities;
6]>
7
8<sect1 id="ch-bootable-fstab">
9 <?dbhtml filename="fstab.html"?>
10
11 <title>Creating the /etc/fstab File</title>
12
13 <indexterm zone="ch-bootable-fstab">
14 <primary sortas="e-/etc/fstab">/etc/fstab</primary>
15 </indexterm>
16
17 <para>The <filename>/etc/fstab</filename> file is used by some programs to
18 determine where file systems are to be mounted by default, in which order, and
19 which must be checked (for integrity errors) prior to mounting. Create a new
20 file systems table like this:</para>
21
22<screen revision="sysv"><userinput>cat &gt; /etc/fstab &lt;&lt; "EOF"
23<literal># Begin /etc/fstab
24
25# file system mount-point type options dump fsck
26# order
27
28/dev/<replaceable>sda</replaceable>3 / ext4 defaults 1 1
29/dev/<replaceable>sda</replaceable>2 /boot ext4 defaults 0 2
30proc /proc proc nosuid,noexec,nodev 0 0
31sysfs /sys sysfs nosuid,noexec,nodev 0 0
32devpts /dev/pts devpts gid=5,mode=620 0 0
33tmpfs /run tmpfs defaults 0 0
34devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
35tmpfs /dev/shm tmpfs nosuid,nodev 0 0
36
37# End /etc/fstab</literal>
38EOF</userinput></screen>
39
40<screen revision="systemd"><userinput>cat &gt; /etc/fstab &lt;&lt; "EOF"
41<literal># Begin /etc/fstab
42
43# file system mount-point type options dump fsck
44# order
45
46/dev/<replaceable>sda</replaceable>3 / ext4 defaults 1 1
47/dev/<replaceable>sda</replaceable>2 /boot ext4 defaults 0 2
48
49# End /etc/fstab</literal>
50EOF</userinput></screen>
51
52 <para>Replace <replaceable>sda</replaceable> to the name of the device
53 node for your disk where LFS is being built. For details on the six
54 fields in this file, see <command>man 5 fstab</command>.</para>
55
56 <para>Filesystems with MS-DOS or Windows origin (i.e. vfat, ntfs, smbfs,
57 cifs, iso9660, udf) need a special option, utf8, in order for non-ASCII
58 characters in file names to be interpreted properly. For non-UTF-8 locales,
59 the value of <option>iocharset</option> should be set to be the same as the
60 character set of the locale, adjusted in such a way that the kernel
61 understands it. This works if the relevant character set definition (found
62 under File systems -&gt; Native Language Support when configuring the kernel)
63 has been compiled into the kernel or built as a module. However, if the
64 character set of the locale is UTF-8, the corresponding option
65 <option>iocharset=utf8</option> would make the file system case sensitive. To
66 fix this, use the special option <option>utf8</option> instead of
67 <option>iocharset=utf8</option>, for UTF-8 locales. The
68 <quote>codepage</quote> option is also needed for vfat and smbfs filesystems.
69 It should be set to the codepage number used under MS-DOS in your country.
70 For example, in order to mount USB flash drives, a ru_RU.KOI8-R user would
71 need the following in the options portion of its mount line in
72 <filename>/etc/fstab</filename>:</para>
73
74<screen><literal>noauto,user,quiet,showexec,codepage=866,iocharset=koi8r</literal></screen>
75
76 <para>The corresponding options fragment for ru_RU.UTF-8 users is:</para>
77
78<screen><literal>noauto,user,quiet,showexec,codepage=866,utf8</literal></screen>
79
80 <para>Note that using <option>iocharset</option> is the default for
81 <literal>iso8859-1</literal> (which keeps the file system case
82 insensitive), and the <option>utf8</option> option tells
83 the kernel to convert the file names using UTF-8 so they can be
84 interpreted in the UTF-8 locale.</para>
85
86 <!--note>
87 <para>In the latter case, the kernel emits the following message:</para>
88
89<screen><computeroutput>FAT: utf8 is not a recommended IO charset for FAT filesystems,
90 filesystem will be case sensitive!</computeroutput></screen>
91
92 <para>This negative recommendation should be ignored, since all other values
93 of the <quote>iocharset</quote> option result in wrong display of filenames in
94 UTF-8 locales.</para>
95 </note-->
96
97 <para>It is also possible to specify default codepage and iocharset values for
98 some filesystems during kernel configuration. The relevant parameters
99 are named
100 <quote>Default NLS Option</quote> (<option>CONFIG_NLS_DEFAULT)</option>,
101 <quote>Default Remote NLS Option</quote> (<option>CONFIG_SMB_NLS_DEFAULT</option>),
102 <quote>Default codepage for FAT</quote> (<option>CONFIG_FAT_DEFAULT_CODEPAGE</option>), and
103 <quote>Default iocharset for FAT</quote> (<option>CONFIG_FAT_DEFAULT_IOCHARSET</option>).
104 There is no way to specify these settings for the
105 ntfs filesystem at kernel compilation time.</para>
106
107 <para>It is possible to make the ext3 filesystem reliable across power
108 failures for some hard disk types. To do this, add the
109 <option>barrier=1</option> mount option to the appropriate entry in
110 <filename>/etc/fstab</filename>. To check if the disk drive supports
111 this option, run
112 <ulink url="&blfs-book;general/hdparm.html">hdparm</ulink>
113 on the applicable disk drive. For example, if:</para>
114
115<screen role="nodump"><userinput>hdparm -I /dev/sda | grep NCQ</userinput></screen>
116
117 <para>returns non-empty output, the option is supported.</para>
118
119 <para>Note: Logical Volume Management (LVM) based partitions cannot use the
120 <option>barrier</option> option.</para>
121
122</sect1>
Note: See TracBrowser for help on using the repository browser.