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">
8 <sect1 id="space-creatingfilesystem">
9 <?dbhtml filename="creatingfilesystem.html"?>
11 <title>Creating a File System on the Partition</title>
13 <para>Now that a blank partition has been set up, the file system can be
14 created. LFS can use any file system recognized by the Linux kernel, but the
15 most common types are ext3 and ext4. The choice of file system can be
16 complex and depends on the characteristics of the files and the size of
17 the partition. For example:</para>
22 <listitem><para>is suitable for small partitions that are updated infrequently
28 <listitem><para>is an upgrade to ext2 that includes a journal
29 to help recover the partition's status in the case of an unclean
30 shutdown. It is commonly used as a general purpose file system.
36 <listitem><para>is the latest version of the ext file system family of
37 partition types. It provides several new capabilities including
38 nano-second timestamps, creation and use of very large files (16 TB), and
39 speed improvements.</para>
44 <para>Other file systems, including FAT32, NTFS, ReiserFS, JFS, and XFS are
45 useful for specialized purposes. More information about these file systems
46 can be found at <ulink
47 url="http://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
49 <para>LFS assumes that the root file system (/) is of type ext4. To create
50 an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
51 partition, run the following:</para>
53 <screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable><xxx></replaceable></userinput></screen>
56 <para>Replace <replaceable><xxx></replaceable> with the name of the LFS
57 partition (<filename class="devicefile">sda5</filename> in our previous
61 <para>Some host distributions use custom features in their filesystem
62 creation tools (E2fsprogs). This can cause problems when booting into your new
63 LFS in Chapter 9, as those features will not be supported by the LFS-installed
64 E2fsprogs; you will get an error similar to <quote>unsupported filesystem
65 features, upgrade your e2fsprogs</quote>. To check if your host system
66 uses custom enhancements, run the following command:</para>
68 <screen role="nodump"><userinput>debugfs -R feature /dev/<replaceable><xxx></replaceable></userinput></screen>
70 <para>If the output contains features other than
71 <option>has_journal</option>, <option>ext_attr</option>,
72 <option>resize_inode</option>, <option>dir_index</option>,
73 <option>filetype</option>, <option>sparse_super</option>,
74 <option>large_file</option> or <option>needs_recovery</option>, then your
75 host system may have custom enhancements. In that case, to avoid later
76 problems, you should compile the stock E2fsprogs package and use the
77 resulting binaries to re-create the filesystem on your LFS partition:</para>
79 <screen role="nodump"><userinput>cd /tmp
80 tar -xzvf /path/to/sources/e2fsprogs-&e2fsprogs-version;.tar.gz
81 cd e2fsprogs-&e2fsprogs-version;
85 make #note that we intentionally don't 'make install' here!
86 ./misc/mke2fs -jv /dev/<replaceable><xxx></replaceable>
88 rm -rfv e2fsprogs-&e2fsprogs-version;</userinput></screen>
91 <para>If you are using an existing <systemitem class="filesystem">swap
92 </systemitem> partition, there is no need to format it. If a new
93 <systemitem class="filesystem"> swap</systemitem> partition was created,
94 it will need to be initialized with this command:</para>
96 <screen role="nodump"><userinput>mkswap /dev/<replaceable><yyy></replaceable></userinput></screen>
98 <para>Replace <replaceable><yyy></replaceable> with the name of the
99 <systemitem class="filesystem">swap</systemitem> partition.</para>