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 |
|
---|
8 | <sect1 id="ch-partitioning-creatingfilesystem">
|
---|
9 | <?dbhtml filename="creatingfilesystem.html"?>
|
---|
10 |
|
---|
11 | <title>Creating a File System on the Partition</title>
|
---|
12 |
|
---|
13 | <para>A partition is just a range of sectors on a disk drive, delimited by
|
---|
14 | boundaries set in a partition table. Before the operating system can use
|
---|
15 | a partition to store any files, the partition must be formatted to contain a file
|
---|
16 | system, typically consisting of a label, directory blocks, data blocks, and
|
---|
17 | an indexing scheme to locate a particular file on demand. The file system
|
---|
18 | also helps the OS keep track of free space on the partition, reserve the
|
---|
19 | needed sectors when a new file is created or an existing file is extended,
|
---|
20 | and recycle the free data segments created when files are deleted. It may
|
---|
21 | also provide support for data redundancy, and for error recovery.</para>
|
---|
22 |
|
---|
23 | <para>LFS can use any file system recognized by the Linux kernel, but the
|
---|
24 | most common types are ext3 and ext4. The choice of the right file system can be
|
---|
25 | complex; it depends on the characteristics of the files and the size of
|
---|
26 | the partition. For example:</para>
|
---|
27 |
|
---|
28 | <variablelist>
|
---|
29 | <varlistentry>
|
---|
30 | <term>ext2</term>
|
---|
31 | <listitem><para>is suitable for small partitions that are updated infrequently
|
---|
32 | such as /boot.</para>
|
---|
33 | </listitem>
|
---|
34 | </varlistentry>
|
---|
35 | <varlistentry>
|
---|
36 | <term>ext3</term>
|
---|
37 | <listitem><para>is an upgrade to ext2 that includes a journal
|
---|
38 | to help recover the partition's status in the case of an unclean
|
---|
39 | shutdown. It is commonly used as a general purpose file system.
|
---|
40 | </para>
|
---|
41 | </listitem>
|
---|
42 | </varlistentry>
|
---|
43 | <varlistentry>
|
---|
44 | <term>ext4</term>
|
---|
45 | <listitem><para>is the latest version of the ext family of
|
---|
46 | file systems. It provides several new capabilities including
|
---|
47 | nano-second timestamps, creation and use of very large files
|
---|
48 | (up to 16 TB), and speed improvements.</para>
|
---|
49 | </listitem>
|
---|
50 | </varlistentry>
|
---|
51 | </variablelist>
|
---|
52 |
|
---|
53 | <para>Other file systems, including FAT32, NTFS, ReiserFS, JFS, and XFS are
|
---|
54 | useful for specialized purposes. More information about these file systems,
|
---|
55 | and many others, can be found at <ulink
|
---|
56 | url="https://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
|
---|
57 |
|
---|
58 | <para>LFS assumes that the root file system (/) is of type ext4. To create
|
---|
59 | an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
|
---|
60 | partition, issue the following command:</para>
|
---|
61 |
|
---|
62 | <screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable><xxx></replaceable></userinput></screen>
|
---|
63 |
|
---|
64 | <para>Replace <replaceable><xxx></replaceable> with the name of the LFS
|
---|
65 | partition.</para>
|
---|
66 |
|
---|
67 | <para>If you are using an existing <systemitem class="filesystem">swap
|
---|
68 | </systemitem> partition, there is no need to format it. If a new
|
---|
69 | <systemitem class="filesystem"> swap</systemitem> partition was created,
|
---|
70 | it will need to be initialized with this command:</para>
|
---|
71 |
|
---|
72 | <screen role="nodump"><userinput>mkswap /dev/<replaceable><yyy></replaceable></userinput></screen>
|
---|
73 |
|
---|
74 | <para>Replace <replaceable><yyy></replaceable> with the name of the
|
---|
75 | <systemitem class="filesystem">swap</systemitem> partition.</para>
|
---|
76 |
|
---|
77 | </sect1>
|
---|