source: chapter10/fstab.xml

trunk
Last change on this file was ea93c11, checked in by Xi Ruoyao <xry111@…>, 3 months ago

treewide: Use <ulink> instead of <filename> for man pages

"gcc(1)" is really not a file name.

Use <ulink> and link to the online man page on
https://man.archlinux.org/ so the user can refer to the man pages more
easily.

The change is done via a sed command and long lines are wrapped
manually.

  • Property mode set to 100644
File size: 6.1 KB
Line 
1<?xml version="1.0" encoding="UTF-8"?>
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>&lt;xxx&gt;</replaceable> / <replaceable>&lt;fff&gt;</replaceable> defaults 1 1
29/dev/<replaceable>&lt;yyy&gt;</replaceable> swap swap pri=1 0 0
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
36cgroup2 /sys/fs/cgroup cgroup2 nosuid,noexec,nodev 0 0
37
38# End /etc/fstab</literal>
39EOF</userinput></screen>
40
41<screen revision="systemd"><userinput>cat &gt; /etc/fstab &lt;&lt; "EOF"
42<literal># Begin /etc/fstab
43
44# file system mount-point type options dump fsck
45# order
46
47/dev/<replaceable>&lt;xxx&gt;</replaceable> / <replaceable>&lt;fff&gt;</replaceable> defaults 1 1
48/dev/<replaceable>&lt;yyy&gt;</replaceable> swap swap pri=1 0 0
49
50# End /etc/fstab</literal>
51EOF</userinput></screen>
52
53 <para>Replace <replaceable>&lt;xxx&gt;</replaceable>,
54 <replaceable>&lt;yyy&gt;</replaceable>, and <replaceable>&lt;fff&gt;</replaceable>
55 with the values appropriate for the system, for example, <filename
56 class="partition">sda2</filename>, <filename
57 class="partition">sda5</filename>, and <systemitem
58 class="filesystem">ext4</systemitem>. For details on the six
59 fields in this file, see <ulink role='man' url='&man;fstab.5'>fstab(5)</ulink>.</para>
60
61 <para>Filesystems with MS-DOS or Windows origin (i.e. vfat, ntfs, smbfs,
62 cifs, iso9660, udf) need a special option, utf8, in order for non-ASCII
63 characters in file names to be interpreted properly. For non-UTF-8 locales,
64 the value of <option>iocharset</option> should be set to be the same as the
65 character set of the locale, adjusted in such a way that the kernel
66 understands it. This works if the relevant character set definition (found
67 under File systems -&gt; Native Language Support when configuring the kernel)
68 has been compiled into the kernel or built as a module. However, if the
69 character set of the locale is UTF-8, the corresponding option
70 <option>iocharset=utf8</option> would make the file system case sensitive. To
71 fix this, use the special option <option>utf8</option> instead of
72 <option>iocharset=utf8</option>, for UTF-8 locales. The
73 <quote>codepage</quote> option is also needed for vfat and smbfs filesystems.
74 It should be set to the codepage number used under MS-DOS in your country.
75 For example, in order to mount USB flash drives, a ru_RU.KOI8-R user would
76 need the following in the options portion of its mount line in
77 <filename>/etc/fstab</filename>:</para>
78
79<screen><literal>noauto,user,quiet,showexec,codepage=866,iocharset=koi8r</literal></screen>
80
81 <para>The corresponding options fragment for ru_RU.UTF-8 users is:</para>
82
83<screen><literal>noauto,user,quiet,showexec,codepage=866,utf8</literal></screen>
84
85 <para>Note that using <option>iocharset</option> is the default for
86 <literal>iso8859-1</literal> (which keeps the file system case
87 insensitive), and the <option>utf8</option> option tells
88 the kernel to convert the file names using UTF-8 so they can be
89 interpreted in the UTF-8 locale.</para>
90
91 <!--note>
92 <para>In the latter case, the kernel emits the following message:</para>
93
94<screen><computeroutput>FAT: utf8 is not a recommended IO charset for FAT filesystems,
95 filesystem will be case sensitive!</computeroutput></screen>
96
97 <para>This negative recommendation should be ignored, since all other values
98 of the <quote>iocharset</quote> option result in wrong display of filenames in
99 UTF-8 locales.</para>
100 </note-->
101
102 <para>It is also possible to specify default codepage and iocharset values for
103 some filesystems during kernel configuration. The relevant parameters
104 are named
105 <quote>Default NLS Option</quote> (<option>CONFIG_NLS_DEFAULT)</option>,
106 <quote>Default Remote NLS Option</quote> (<option>CONFIG_SMB_NLS_DEFAULT</option>),
107 <quote>Default codepage for FAT</quote> (<option>CONFIG_FAT_DEFAULT_CODEPAGE</option>), and
108 <quote>Default iocharset for FAT</quote> (<option>CONFIG_FAT_DEFAULT_IOCHARSET</option>).
109 There is no way to specify these settings for the
110 ntfs filesystem at kernel compilation time.</para>
111
112 <para>It is possible to make the ext3 filesystem reliable across power
113 failures for some hard disk types. To do this, add the
114 <option>barrier=1</option> mount option to the appropriate entry in
115 <filename>/etc/fstab</filename>. To check if the disk drive supports
116 this option, run
117 <ulink url="&blfs-book;general/hdparm.html">hdparm</ulink>
118 on the applicable disk drive. For example, if:</para>
119
120<screen role="nodump"><userinput>hdparm -I /dev/sda | grep NCQ</userinput></screen>
121
122 <para>returns non-empty output, the option is supported.</para>
123
124 <para>Note: Logical Volume Management (LVM) based partitions cannot use the
125 <option>barrier</option> option.</para>
126
127</sect1>
Note: See TracBrowser for help on using the repository browser.