mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-01-18 21:17:38 +00:00
97 lines
4.2 KiB
XML
97 lines
4.2 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
|
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
|
<!ENTITY % general-entities SYSTEM "../general.ent">
|
|
%general-entities;
|
|
]>
|
|
|
|
<sect1 id="ch-partitioning-creatingfilesystem">
|
|
<?dbhtml filename="creatingfilesystem.html"?>
|
|
|
|
<title>Creating a File System on the Partition</title>
|
|
|
|
<para>A partition is just a range of sectors on a disk drive, delimited by
|
|
boundaries set in a partition table. Before the operating system can use
|
|
a partition to store any files, the partition must be formatted to contain a file
|
|
system, typically consisting of a label, directory blocks, data blocks, and
|
|
an indexing scheme to locate a particular file on demand. The file system
|
|
also helps the OS keep track of free space on the partition, reserve the
|
|
needed sectors when a new file is created or an existing file is extended,
|
|
and recycle the free data segments created when files are deleted. It may
|
|
also provide support for data redundancy, and for error recovery.</para>
|
|
|
|
<para>LFS can use any file system recognized by the Linux kernel, but the
|
|
most common types are ext3 and ext4. The choice of the right file system can be
|
|
complex; it depends on the characteristics of the files and the size of
|
|
the partition. For example:</para>
|
|
|
|
<variablelist>
|
|
<varlistentry>
|
|
<term>ext2</term>
|
|
<listitem><para>is suitable for small partitions that are updated infrequently
|
|
such as /boot.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>ext3</term>
|
|
<listitem><para>is an upgrade to ext2 that includes a journal
|
|
to help recover the partition's status in the case of an unclean
|
|
shutdown. It is commonly used as a general purpose file system.
|
|
</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
<varlistentry>
|
|
<term>ext4</term>
|
|
<listitem><para>is the latest version of the ext family of
|
|
file systems. It provides several new capabilities including
|
|
nano-second timestamps, creation and use of very large files
|
|
(up to 16 TB), and speed improvements.</para>
|
|
</listitem>
|
|
</varlistentry>
|
|
</variablelist>
|
|
|
|
<para>Other file systems, including FAT32, NTFS, JFS, and XFS are
|
|
useful for specialized purposes. More information about these file systems,
|
|
and many others, can be found at <ulink
|
|
url="https://en.wikipedia.org/wiki/Comparison_of_file_systems"/>.</para>
|
|
|
|
<para>LFS assumes that the root file system (/) is of type ext4. To create
|
|
an <systemitem class="filesystem">ext4</systemitem> file system on the LFS
|
|
partition, issue the following command:</para>
|
|
|
|
<screen role="nodump"><userinput>mkfs -v -t ext4 /dev/<replaceable><xxx></replaceable></userinput></screen>
|
|
|
|
<para>Replace <replaceable><xxx></replaceable> with the name of the LFS
|
|
partition.</para>
|
|
|
|
<para>If you are using an existing <systemitem class="filesystem">swap
|
|
</systemitem> partition, there is no need to format it. If a new
|
|
<systemitem class="filesystem">swap</systemitem> partition was created,
|
|
it will need to be initialized with this command:</para>
|
|
|
|
<screen role="nodump"><userinput>mkswap /dev/<replaceable><yyy></replaceable></userinput></screen>
|
|
|
|
<para>Replace <replaceable><yyy></replaceable> with the name of the
|
|
<systemitem class="filesystem">swap</systemitem> partition.</para>
|
|
|
|
<para>If you have created an EFI System Partition, you have a few options.
|
|
Motherboards when booting with UEFI look for EFI applications in partitions
|
|
formatted with a FAT variant (FAT12, FAT16, FAT32, VFAT, etc). Usually,
|
|
FAT32 or VFAT are the recommended options.</para>
|
|
|
|
<para>If you have chosen <systemitem class="filesystem">FAT32</systemitem>,
|
|
format the ESP with the following command:</para>
|
|
|
|
<screen role="nodump"><userinput>mkfs.fat -F 32 /dev/<replaceable><yyy></replaceable></userinput></screen>
|
|
|
|
<para>On the other hand, if you have chosen
|
|
<systemitem class="filesystem">VFAT</systemitem>, you can run the following
|
|
instead:</para>
|
|
|
|
<screen role="nodump"><userinput>mkfs.vfat /dev/<replaceable><yyy></replaceable></userinput></screen>
|
|
|
|
<para>Replace <replaceable><yyy></replaceable> with the name of the
|
|
EFI System Partition.</para>
|
|
|
|
</sect1>
|