[673b0d8] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[b78c747] | 7 |
|
---|
[3be4d97] | 8 | <sect1 id="ch-bootable-fstab">
|
---|
[b78c747] | 9 | <?dbhtml filename="fstab.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>Creating the /etc/fstab File</title>
|
---|
[673b0d8] | 12 |
|
---|
[b78c747] | 13 | <indexterm zone="ch-bootable-fstab">
|
---|
| 14 | <primary sortas="e-/etc/fstab">/etc/fstab</primary>
|
---|
| 15 | </indexterm>
|
---|
[81fd230] | 16 |
|
---|
[b78c747] | 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>
|
---|
[81fd230] | 21 |
|
---|
[1118b17] | 22 | <screen revision="sysv"><userinput>cat > /etc/fstab << "EOF"
|
---|
[d72e04a] | 23 | <literal># Begin /etc/fstab
|
---|
[6370fa6] | 24 |
|
---|
[e9ba8aa8] | 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
|
---|
[654dc0d] | 32 | devpts /dev/pts devpts gid=5,mode=620 0 0
|
---|
[e9ba8aa8] | 33 | tmpfs /run tmpfs defaults 0 0
|
---|
| 34 | devtmpfs /dev devtmpfs mode=0755,nosuid 0 0
|
---|
| 35 |
|
---|
[1118b17] | 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 |
|
---|
[d72e04a] | 48 | # End /etc/fstab</literal>
|
---|
[0719866] | 49 | EOF</userinput></screen>
|
---|
[6370fa6] | 50 |
|
---|
[0090db5] | 51 | <para>Replace <replaceable><xxx></replaceable>,
|
---|
| 52 | <replaceable><yyy></replaceable>, and <replaceable><fff></replaceable>
|
---|
[b78c747] | 53 | with the values appropriate for the system, for example, <filename
|
---|
[cd591a6] | 54 | class="partition">sda2</filename>, <filename
|
---|
| 55 | class="partition">sda5</filename>, and <systemitem
|
---|
[4e7e16d] | 56 | class="filesystem">ext4</systemitem>. For details on the six
|
---|
[b78c747] | 57 | fields in this file, see <command>man 5 fstab</command>.</para>
|
---|
[81fd230] | 58 |
|
---|
[f7cf1fb] | 59 | <para>Filesystems with MS-DOS or Windows origin (i.e. vfat, ntfs, smbfs,
|
---|
| 60 | cifs, iso9660, udf) need a special option, utf8, in order for non-ASCII
|
---|
| 61 | characters in file names to be interpreted properly. For non-UTF-8 locales,
|
---|
| 62 | the value of <option>iocharset</option> should be set to be the same as the
|
---|
| 63 | character set of the locale, adjusted in such a way that the kernel
|
---|
| 64 | understands it. This works if the relevant character set definition (found
|
---|
| 65 | under File systems -> Native Language Support when configuring the kernel)
|
---|
| 66 | has been compiled into the kernel or built as a module. However, if the
|
---|
| 67 | character set of the locale is UTF-8, the corresponding option
|
---|
| 68 | <option>iocharset=utf8</option> would make the file system case sensitive. To
|
---|
| 69 | fix this, use the special option <option>utf8</option> instead of
|
---|
| 70 | <option>iocharset=utf8</option>, for UTF-8 locales. The
|
---|
| 71 | <quote>codepage</quote> option is also needed for vfat and smbfs filesystems.
|
---|
| 72 | It should be set to the codepage number used under MS-DOS in your country.
|
---|
| 73 | For example, in order to mount USB flash drives, a ru_RU.KOI8-R user would
|
---|
| 74 | need the following in the options portion of its mount line in
|
---|
| 75 | <filename>/etc/fstab</filename>:</para>
|
---|
| 76 |
|
---|
| 77 | <screen><literal>noauto,user,quiet,showexec,codepage=866,iocharset=koi8r</literal></screen>
|
---|
[fa21b3d] | 78 |
|
---|
[1652151] | 79 | <para>The corresponding options fragment for ru_RU.UTF-8 users is:</para>
|
---|
[fa21b3d] | 80 |
|
---|
[f7cf1fb] | 81 | <screen><literal>noauto,user,quiet,showexec,codepage=866,utf8</literal></screen>
|
---|
[fa21b3d] | 82 |
|
---|
[f7cf1fb] | 83 | <para>Note that using <option>iocharset</option> is the default for
|
---|
| 84 | <literal>iso8859-1</literal> (which keeps the file system case
|
---|
| 85 | insensitive), and the <option>utf8</option> option tells
|
---|
| 86 | the kernel to convert the file names using UTF-8 so they can be
|
---|
| 87 | interpreted in the UTF-8 locale.</para>
|
---|
| 88 |
|
---|
| 89 | <!--note>
|
---|
[c226182] | 90 | <para>In the latter case, the kernel emits the following message:</para>
|
---|
[fa21b3d] | 91 |
|
---|
[c226182] | 92 | <screen><computeroutput>FAT: utf8 is not a recommended IO charset for FAT filesystems,
|
---|
| 93 | filesystem will be case sensitive!</computeroutput></screen>
|
---|
[fa21b3d] | 94 |
|
---|
[c226182] | 95 | <para>This negative recommendation should be ignored, since all other values
|
---|
| 96 | of the <quote>iocharset</quote> option result in wrong display of filenames in
|
---|
| 97 | UTF-8 locales.</para>
|
---|
[f7cf1fb] | 98 | </note-->
|
---|
[fa21b3d] | 99 |
|
---|
| 100 | <para>It is also possible to specify default codepage and iocharset values for
|
---|
| 101 | some filesystems during kernel configuration. The relevant parameters
|
---|
| 102 | are named
|
---|
[c8c2b89] | 103 | <quote>Default NLS Option</quote> (<option>CONFIG_NLS_DEFAULT)</option>,
|
---|
| 104 | <quote>Default Remote NLS Option</quote> (<option>CONFIG_SMB_NLS_DEFAULT</option>),
|
---|
| 105 | <quote>Default codepage for FAT</quote> (<option>CONFIG_FAT_DEFAULT_CODEPAGE</option>), and
|
---|
| 106 | <quote>Default iocharset for FAT</quote> (<option>CONFIG_FAT_DEFAULT_IOCHARSET</option>).
|
---|
[fa21b3d] | 107 | There is no way to specify these settings for the
|
---|
| 108 | ntfs filesystem at kernel compilation time.</para>
|
---|
| 109 |
|
---|
[af611557] | 110 | <para>It is possible to make the ext3 filesystem reliable across power
|
---|
| 111 | failures for some hard disk types. To do this, add the
|
---|
| 112 | <option>barrier=1</option> mount option to the appropriate entry in
|
---|
| 113 | <filename>/etc/fstab</filename>. To check if the disk drive supports
|
---|
[2ca8941] | 114 | this option, run
|
---|
[0ee07e5] | 115 | <ulink url="&blfs-book;general/hdparm.html">hdparm</ulink>
|
---|
[af611557] | 116 | on the applicable disk drive. For example, if:</para>
|
---|
| 117 |
|
---|
[5612386] | 118 | <screen role="nodump"><userinput>hdparm -I /dev/sda | grep NCQ</userinput></screen>
|
---|
[af611557] | 119 |
|
---|
| 120 | <para>returns non-empty output, the option is supported.</para>
|
---|
| 121 |
|
---|
| 122 | <para>Note: Logical Volume Management (LVM) based partitions cannot use the
|
---|
| 123 | <option>barrier</option> option.</para>
|
---|
| 124 |
|
---|
[6370fa6] | 125 | </sect1>
|
---|