[dcff046] | 1 | <chapter id="chapter-making-space" xreflabel="Chapter 3">
|
---|
[6370fa6] | 2 | <title>Preparing a new partition</title>
|
---|
[14245db] | 3 | <?dbhtml filename="chapter03.html" dir="chapter03"?>
|
---|
[6370fa6] | 4 |
|
---|
[33ea9e9] | 5 |
|
---|
[3be4d97] | 6 | <sect1 id="ch-space-introduction">
|
---|
[33ea9e9] | 7 | <title>Introduction</title>
|
---|
| 8 | <?dbhtml filename="introduction.html" dir="chapter03"?>
|
---|
| 9 |
|
---|
| 10 | <para>In this chapter the partition which will host the LFS system is
|
---|
| 11 | prepared. We will create the partition itself, make a file system on it,
|
---|
| 12 | and mount it.</para>
|
---|
| 13 |
|
---|
| 14 | </sect1>
|
---|
| 15 |
|
---|
| 16 |
|
---|
[3be4d97] | 17 | <sect1 id="ch-space-creatingpart">
|
---|
[33ea9e9] | 18 | <title>Creating a new partition</title>
|
---|
| 19 | <?dbhtml filename="creatingpart.html" dir="chapter03"?>
|
---|
| 20 |
|
---|
| 21 | <para>In order to build our new Linux system, we will need some space:
|
---|
| 22 | an empty disk partition. If you don't have a free partition, and no room
|
---|
| 23 | on any of your hard disks to make one, then you could build LFS on the
|
---|
| 24 | same partition as the one on which your current distribution is installed.
|
---|
| 25 | This procedure is not recommended for your first LFS install, but if you
|
---|
| 26 | are short on disk space, and you feel brave, take a look at the hint at
|
---|
| 27 | <ulink url="&hints-root;lfs_next_to_existing_systems.txt"/>.</para>
|
---|
| 28 |
|
---|
| 29 | <para>For a minimal system you will need a partition of around 1.2 GB.
|
---|
| 30 | This is enough to store all the source tarballs and compile all the packages.
|
---|
| 31 | But if you intend to use the LFS system as your primary Linux system, you
|
---|
| 32 | will probably want to install additional software, and will need more space
|
---|
| 33 | than this, probably around 2 or 3 GB.</para>
|
---|
| 34 |
|
---|
| 35 | <para>As we almost never have enough RAM in our box, it is a good idea to
|
---|
| 36 | use a small disk partition as swap space -- this space is used by the kernel
|
---|
| 37 | to store seldom-used data to make room in memory for more urgent stuff.
|
---|
| 38 | The swap partition for your LFS system can be the same one as for your host
|
---|
| 39 | system, so you won't have to create another if your host system already uses
|
---|
| 40 | a swap partition.</para>
|
---|
| 41 |
|
---|
[90e3cb3] | 42 | <para>Start a disk partitioning program such as <command>cfdisk</command>
|
---|
| 43 | or <command>fdisk</command> with an argument naming the hard disk upon
|
---|
[33ea9e9] | 44 | which the new partition must be created -- for example
|
---|
| 45 | <filename>/dev/hda</filename> for the primary IDE disk. Create a Linux native
|
---|
| 46 | partition and a swap partition, if needed. Please refer to the man pages of
|
---|
[90e3cb3] | 47 | <command>cfdisk</command> or <command>fdisk</command> if you don't yet
|
---|
[33ea9e9] | 48 | know how to use the programs.</para>
|
---|
| 49 |
|
---|
| 50 | <para>Remember the designation of your new partition -- something like
|
---|
| 51 | <filename>hda5</filename>. This book will refer to it as the LFS partition.
|
---|
| 52 | If you (now) also have a swap partition, remember its designation too. These
|
---|
| 53 | names will later be needed for the <filename>/etc/fstab</filename> file.</para>
|
---|
| 54 |
|
---|
| 55 | </sect1>
|
---|
| 56 |
|
---|
| 57 |
|
---|
[3be4d97] | 58 | <sect1 id="ch-space-creatingfs">
|
---|
[33ea9e9] | 59 | <title>Creating a file system on the new partition</title>
|
---|
| 60 | <?dbhtml filename="creatingfs.html" dir="chapter03"?>
|
---|
| 61 |
|
---|
| 62 | <para>Now that we have a blank partition, we can create a file system on it.
|
---|
| 63 | Most widely used in the Linux world is the second extended file system (ext2),
|
---|
[ab3b93b] | 64 | but with the high-capacity hard disks of today the so-called journaling
|
---|
| 65 | file systems are becoming increasingly popular. Here we will create an ext2
|
---|
| 66 | file system, but build instructions for other file systems can be found at
|
---|
| 67 | <ulink url="&blfs-root;view/stable/postlfs/filesystems.html"/>.</para>
|
---|
[33ea9e9] | 68 |
|
---|
| 69 | <para>To create an ext2 file system on the LFS partition run the following:</para>
|
---|
| 70 |
|
---|
| 71 | <screen><userinput>mke2fs /dev/xxx</userinput></screen>
|
---|
| 72 |
|
---|
| 73 | <para>Replace <filename>xxx</filename> with the name of the LFS partition
|
---|
| 74 | (something like <filename>hda5</filename>).</para>
|
---|
| 75 |
|
---|
| 76 | <para>If you created a (new) swap partition you need to initialize it as a
|
---|
| 77 | swap partition too (also known as formatting, like you did above with
|
---|
[4248b0e] | 78 | <command>mke2fs</command>) by running:</para>
|
---|
[33ea9e9] | 79 |
|
---|
| 80 | <screen><userinput>mkswap /dev/yyy</userinput></screen>
|
---|
| 81 |
|
---|
| 82 | <para>Replace <filename>yyy</filename> with the name of the swap
|
---|
| 83 | partition.</para>
|
---|
| 84 |
|
---|
| 85 | </sect1>
|
---|
| 86 |
|
---|
| 87 |
|
---|
[3be4d97] | 88 | <sect1 id="ch-space-mounting">
|
---|
[33ea9e9] | 89 | <title>Mounting the new partition</title>
|
---|
| 90 | <?dbhtml filename="mounting.html" dir="chapter03"?>
|
---|
| 91 |
|
---|
| 92 | <para>Now that we've created a file system, we want to be able to access
|
---|
| 93 | the partition. For that, we need to mount it, and have to choose a mount
|
---|
| 94 | point. In this book we assume that the file system is mounted under
|
---|
| 95 | <filename>/mnt/lfs</filename>, but it doesn't matter what directory
|
---|
| 96 | you choose.</para>
|
---|
| 97 |
|
---|
| 98 | <para>Choose a mount point and assign it to the LFS environment variable
|
---|
| 99 | by running:</para>
|
---|
| 100 |
|
---|
| 101 | <screen><userinput>export LFS=/mnt/lfs</userinput></screen>
|
---|
| 102 |
|
---|
| 103 | <para>Now create the mount point and mount the LFS file system by running:</para>
|
---|
| 104 |
|
---|
| 105 | <screen><userinput>mkdir -p $LFS
|
---|
| 106 | mount /dev/xxx $LFS</userinput></screen>
|
---|
| 107 |
|
---|
| 108 | <para>Replace <filename>xxx</filename> with the designation of the LFS
|
---|
| 109 | partition.</para>
|
---|
| 110 |
|
---|
| 111 | <para>If you have decided to use multiple partitions for LFS (say one for
|
---|
| 112 | <filename>/</filename> and another for <filename>/usr</filename>), mount
|
---|
| 113 | them like this:</para>
|
---|
| 114 |
|
---|
| 115 | <screen><userinput>mkdir -p $LFS
|
---|
| 116 | mount /dev/xxx $LFS
|
---|
| 117 | mkdir $LFS/usr
|
---|
| 118 | mount /dev/yyy $LFS/usr</userinput></screen>
|
---|
| 119 |
|
---|
| 120 | <para>Of course, replace <filename>xxx</filename> and <filename>yyy</filename>
|
---|
| 121 | with the appropriate partition names.</para>
|
---|
| 122 |
|
---|
| 123 | <para>You should also ensure that this new partition is not mounted with
|
---|
| 124 | permissions that are too restrictive (such as the nosuid, nodev or noatime
|
---|
[90e3cb3] | 125 | options). You can run the <command>mount</command> command without any
|
---|
[33ea9e9] | 126 | parameters to see with what options the LFS partition is mounted. If
|
---|
| 127 | you see nosuid, nodev or noatime, you will need to remount it.</para>
|
---|
| 128 |
|
---|
| 129 | <para>Now that we've made ourselves a place to work in, we're ready to download
|
---|
| 130 | the packages.</para>
|
---|
| 131 |
|
---|
| 132 | </sect1>
|
---|
| 133 |
|
---|
[6370fa6] | 134 |
|
---|
| 135 | </chapter>
|
---|