fstab.xml 5.9 KB

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