chapter03.xml 5.4 KB

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