creatingfilesystem.xml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. <sect1 id="space-creatingfilesystem">
  8. <?dbhtml filename="creatingfilesystem.html"?>
  9. <title>在分区上建立文件系统</title>
  10. <!--para>Now that a blank partition has been set up, the file system can be
  11. created. LFS can use any file system recognized by the Linux kernel, but the
  12. most common types are ext3 and ext4. The choice of file system can be
  13. complex and depends on the characteristics of the files and the size of
  14. the partition. For example:</para-->
  15. <para>现在我们建立好了空白分区,可以在分区上建立文件系统。
  16. LFS 可以使用 Linux 内核能够识别的任何文件系统,
  17. 最常见的是 ext3 和 ext4。
  18. 文件系统的选型是一个复杂的问题,要综合考虑分区的大小,
  19. 以及其中所存储文件的特征。例如:</para>
  20. <variablelist>
  21. <varlistentry>
  22. <term>ext2</term>
  23. <listitem><para>适用于不经常更新的小分区,例如 /boot。</para>
  24. </listitem>
  25. </varlistentry>
  26. <varlistentry>
  27. <term>ext3</term>
  28. <listitem><para>是 ext2 的升级版本,拥有日志系统,
  29. 能够在非正常关机的情况下恢复分区的正常状态。
  30. 它被广泛用于一般场合。
  31. </para>
  32. </listitem>
  33. </varlistentry>
  34. <varlistentry>
  35. <term>ext4</term>
  36. <listitem><para>是 ext 文件系统家族的最新成员,它具有纳秒精度时间戳、
  37. 超大 (16 TB) 文件支持等新功能,速度也更快。</para>
  38. </listitem>
  39. </varlistentry>
  40. </variablelist>
  41. <!--para>Other file systems, including FAT32, NTFS, ReiserFS, JFS, and XFS are
  42. useful for specialized purposes. More information about these file systems
  43. can be found at <ulink
  44. url="http://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
  45. <para>LFS assumes that the root file system (/) is of type ext4. To create
  46. an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
  47. partition, run the following:</para-->
  48. <para>其他文件系统,包括 FAT32, NTFS, ReiserFS, JFS 和 XFS
  49. 在特定场合也很有用。关于这些文件系统的更多信息,可以在
  50. <ulink url="http://en.wikipedia.org/wiki/Comparison_of_file_systems"/>
  51. 找到。</para>
  52. <para>LFS 假设根文件系统 (/) 采用 ext4 文件系统。
  53. 输入以下命令在 LFS 分区创建一个 ext4 文件系统:</para>
  54. <screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
  55. <!--
  56. <para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the name of the LFS
  57. partition (<filename class="devicefile">sda5</filename> in our previous
  58. example).</para>
  59. <note>
  60. <para>Some host distributions use custom features in their filesystem
  61. creation tools (E2fsprogs). This can cause problems when booting into your new
  62. LFS in Chapter&nbsp;9, as those features will not be supported by the LFS-installed
  63. E2fsprogs; you will get an error similar to <quote>unsupported filesystem
  64. features, upgrade your e2fsprogs</quote>. To check if your host system
  65. uses custom enhancements, run the following command:</para>
  66. <screen role="nodump"><userinput>debugfs -R feature /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
  67. <para>If the output contains features other than
  68. <option>has_journal</option>, <option>ext_attr</option>,
  69. <option>resize_inode</option>, <option>dir_index</option>,
  70. <option>filetype</option>, <option>sparse_super</option>,
  71. <option>large_file</option> or <option>needs_recovery</option>, then your
  72. host system may have custom enhancements. In that case, to avoid later
  73. problems, you should compile the stock E2fsprogs package and use the
  74. resulting binaries to re-create the filesystem on your LFS partition:</para>
  75. <screen role="nodump"><userinput>cd /tmp
  76. tar -xzvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.gz
  77. cd e2fsprogs-&e2fsprogs-version;
  78. mkdir -v build
  79. cd build
  80. ../configure
  81. make #note that we intentionally don't 'make install' here!
  82. ./misc/mke2fs -jv /dev/<replaceable>&lt;xxx&gt;</replaceable>
  83. cd /tmp
  84. rm -rfv e2fsprogs-&e2fsprogs-version;</userinput></screen>
  85. </note>
  86. -->
  87. <!--para>If you are using an existing <systemitem class="filesystem">swap
  88. </systemitem> partition, there is no need to format it. If a new
  89. <systemitem class="filesystem"> swap</systemitem> partition was created,
  90. it will need to be initialized with this command:</para-->
  91. <para>如果您拥有一个现成的
  92. <systemitem class="filesystem">swap</systemitem>分区,
  93. 就不需要格式化它。如果新创建了一个
  94. <systemitem class="filesystem">swap</systemitem>分区,
  95. 需要执行以下命令以初始化它:
  96. </para>
  97. <screen role="nodump"><userinput>mkswap /dev/<replaceable>&lt;yyy&gt;</replaceable></userinput></screen>
  98. <!--para>Replace <replaceable>&lt;yyy&gt;</replaceable> with the name of the
  99. <systemitem class="filesystem">swap</systemitem> partition.</para-->
  100. <para>命令中 <replaceable>&lt;yyy&gt;</replaceable> 应该替换成
  101. <systemitem class="filesystem">swap</systemitem> 分区的名称。</para>
  102. </sect1>