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