creatingfilesystem.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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="space-creatingfilesystem">
  8. <?dbhtml filename="creatingfilesystem.html"?>
  9. <title>Creating a File System on the Partition</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. <variablelist>
  16. <varlistentry>
  17. <term>ext2</term>
  18. <listitem><para>is suitable for small partitions that are updated infrequently
  19. such as /boot.</para>
  20. </listitem>
  21. </varlistentry>
  22. <varlistentry>
  23. <term>ext3</term>
  24. <listitem><para>is an upgrade to ext2 that includes a journal
  25. to help recover the partition's status in the case of an unclean
  26. shutdown. It is commonly used as a general purpose file system.
  27. </para>
  28. </listitem>
  29. </varlistentry>
  30. <varlistentry>
  31. <term>ext4</term>
  32. <listitem><para>is the latest version of the ext file system family of
  33. partition types. It provides several new capabilities including
  34. nano-second timestamps, creation and use of very large files (16 TB), and
  35. speed improvements.</para>
  36. </listitem>
  37. </varlistentry>
  38. </variablelist>
  39. <para>Other file sytems, including FAT32, NTFS, ReiserFS, JFS, and XFS are
  40. useful for specialized purposes. More information about these file systems
  41. can be found at <ulink
  42. url="http://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
  43. <para>LFS assumes that the root file system (/) is of type ext4. To create
  44. an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
  45. partition, run the following:</para>
  46. <screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
  47. <!--
  48. <para>Replace <replaceable>&lt;xxx&gt;</replaceable> with the name of the LFS
  49. partition (<filename class="devicefile">sda5</filename> in our previous
  50. example).</para>
  51. <note>
  52. <para>Some host distributions use custom features in their filesystem
  53. creation tools (E2fsprogs). This can cause problems when booting into your new
  54. LFS in Chapter 9, as those features will not be supported by the LFS-installed
  55. E2fsprogs; you will get an error similar to <quote>unsupported filesystem
  56. features, upgrade your e2fsprogs</quote>. To check if your host system
  57. uses custom enhancements, run the following command:</para>
  58. <screen role="nodump"><userinput>debugfs -R feature /dev/<replaceable>&lt;xxx&gt;</replaceable></userinput></screen>
  59. <para>If the output contains features other than
  60. <option>has_journal</option>, <option>ext_attr</option>,
  61. <option>resize_inode</option>, <option>dir_index</option>,
  62. <option>filetype</option>, <option>sparse_super</option>,
  63. <option>large_file</option> or <option>needs_recovery</option>, then your
  64. host system may have custom enhancements. In that case, to avoid later
  65. problems, you should compile the stock E2fsprogs package and use the
  66. resulting binaries to re-create the filesystem on your LFS partition:</para>
  67. <screen role="nodump"><userinput>cd /tmp
  68. tar -xzvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.gz
  69. cd e2fsprogs-&e2fsprogs-version;
  70. mkdir -v build
  71. cd build
  72. ../configure
  73. make #note that we intentionally don't 'make install' here!
  74. ./misc/mke2fs -jv /dev/<replaceable>&lt;xxx&gt;</replaceable>
  75. cd /tmp
  76. rm -rfv e2fsprogs-&e2fsprogs-version;</userinput></screen>
  77. </note>
  78. -->
  79. <para>If you are using an existing <systemitem class="filesystem">swap
  80. </systemitem> partition, there is no need to format it. If a new
  81. <systemitem class="filesystem"> swap</systemitem> partition was created,
  82. it will need to be initialized with this command:</para>
  83. <screen role="nodump"><userinput>mkswap /dev/<replaceable>&lt;yyy&gt;</replaceable></userinput></screen>
  84. <para>Replace <replaceable>&lt;yyy&gt;</replaceable> with the name of the
  85. <systemitem class="filesystem">swap</systemitem> partition.</para>
  86. </sect1>