[7152faa] | 1 | <?xml version="1.0" encoding="UTF-8"?>
|
---|
[b06ca36] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[673b0d8] | 4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
| 5 | %general-entities;
|
---|
| 6 | ]>
|
---|
[87bae31] | 7 |
|
---|
[afcfd74] | 8 | <sect1 id="ch-partitioning-creatingfilesystem">
|
---|
[87bae31] | 9 | <?dbhtml filename="creatingfilesystem.html"?>
|
---|
| 10 |
|
---|
| 11 | <title>Creating a File System on the Partition</title>
|
---|
[673b0d8] | 12 |
|
---|
[4ca79662] | 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
|
---|
[f001ece] | 15 | a partition to store any files, the partition must be formatted to contain a file
|
---|
[4ca79662] | 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
|
---|
[4e7e16d] | 26 | the partition. For example:</para>
|
---|
[81fd230] | 27 |
|
---|
[4e7e16d] | 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
|
---|
[a04b192f] | 38 | to help recover the partition's status in the case of an unclean
|
---|
[4e7e16d] | 39 | shutdown. It is commonly used as a general purpose file system.
|
---|
| 40 | </para>
|
---|
| 41 | </listitem>
|
---|
| 42 | </varlistentry>
|
---|
| 43 | <varlistentry>
|
---|
| 44 | <term>ext4</term>
|
---|
[4ca79662] | 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>
|
---|
[4e7e16d] | 49 | </listitem>
|
---|
| 50 | </varlistentry>
|
---|
| 51 | </variablelist>
|
---|
[81fd230] | 52 |
|
---|
[5ff2f2e4] | 53 | <para>Other file systems, including FAT32, NTFS, JFS, and XFS are
|
---|
[4ca79662] | 54 | useful for specialized purposes. More information about these file systems,
|
---|
| 55 | and many others, can be found at <ulink
|
---|
[fb66c4c] | 56 | url="https://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
|
---|
[81fd230] | 57 |
|
---|
[4ca79662] | 58 | <para>LFS assumes that the root file system (/) is of type ext4. To create
|
---|
[4e7e16d] | 59 | an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
|
---|
[4ca79662] | 60 | partition, issue the following command:</para>
|
---|
[4e7e16d] | 61 |
|
---|
| 62 | <screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable><xxx></replaceable></userinput></screen>
|
---|
| 63 |
|
---|
[0090db5] | 64 | <para>Replace <replaceable><xxx></replaceable> with the name of the LFS
|
---|
[b99b7d3] | 65 | partition.</para>
|
---|
[81fd230] | 66 |
|
---|
[ea14853] | 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>
|
---|
[81fd230] | 71 |
|
---|
[0090db5] | 72 | <screen role="nodump"><userinput>mkswap /dev/<replaceable><yyy></replaceable></userinput></screen>
|
---|
[81fd230] | 73 |
|
---|
[0090db5] | 74 | <para>Replace <replaceable><yyy></replaceable> with the name of the
|
---|
[87bae31] | 75 | <systemitem class="filesystem">swap</systemitem> partition.</para>
|
---|
[1422130] | 76 |
|
---|
[673b0d8] | 77 | </sect1>
|
---|