creatingpartition.xml 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  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. <sect1 id="space-creatingpartition">
  8. <?dbhtml filename="creatingpartition.html"?>
  9. <title>Creating a New Partition</title>
  10. <para>Like most other operating systems, LFS is usually installed on a
  11. dedicated partition. The recommended approach to building an LFS system
  12. is to use an available empty partition or, if you have enough unpartitioned
  13. space, to create one.</para>
  14. <!--
  15. <para>It is possible to install an LFS system (in fact even multiple LFS
  16. systems) on a partition already occupied by another
  17. operating system and the different systems will co-exist peacefully. The
  18. document <ulink url="&hints-root;lfs_next_to_existing_systems.txt"/>
  19. contains notes on how to implement this. This document was last updated
  20. in 2004. It has not been updated since and it has not been tested with
  21. recent versions of this LFS book. The document is more than likely not
  22. usable as-is and you will need to account for changes made to the LFS
  23. procedures since it was written. This is only recommended for expert LFS
  24. users.</para>
  25. -->
  26. <para>A minimal system requires a partition of around 6 gigabytes (GB).
  27. This is enough to store all the source tarballs and compile the packages.
  28. However, if the LFS system is intended to be the primary Linux system,
  29. additional software will probably be installed which will require additional
  30. space. A 20 GB partition is a reasonable size to provide for growth. The LFS
  31. system itself will not take up this much room. A large portion of this
  32. requirement is to provide sufficient free temporary storage as well as
  33. for adding additional capabilities after LFS is complete. Additionally, compiling
  34. packages can require a lot of disk space which will be reclaimed after the
  35. package is installed.</para>
  36. <para>Because there is not always enough Random Access Memory (RAM) available
  37. for compilation processes, it is a good idea to use a small disk partition as
  38. <systemitem class="filesystem">swap</systemitem> space. This is used by the
  39. kernel to store seldom-used data and leave more memory available for active
  40. processes. The <systemitem class="filesystem">swap</systemitem> partition for
  41. an LFS system can be the same as the one used by the host system, in which
  42. case it is not necessary to create another one.</para>
  43. <para>Start a disk partitioning program such as <command>cfdisk</command>
  44. or <command>fdisk</command> with a command line option naming the hard
  45. disk on which the new partition will be created&mdash;for example
  46. <filename class="devicefile">/dev/sda</filename> for the primary Integrated
  47. Drive Electronics (IDE) disk. Create a Linux native partition and a
  48. <systemitem class="filesystem">swap</systemitem> partition, if needed. Please
  49. refer to <filename>cfdisk(8)</filename> or <filename>fdisk(8)</filename> if
  50. you do not yet know how to use the programs.</para>
  51. <note><para>For experienced users, other partitioning schemes are possible.
  52. The new LFS system can be on a software <ulink
  53. url="&blfs-book;postlfs/raid.html">RAID</ulink> array or an <ulink
  54. url="&blfs-book;postlfs/aboutlvm.html">LVM</ulink> logical volume.
  55. However, some of these options require an <ulink
  56. url="&blfs-book;postlfs/initramfs.html">initramfs</ulink>, which is
  57. an advanced topic. These partitioning methodologies are not recommended for
  58. first time LFS users.</para></note>
  59. <para>Remember the designation of the new partition (e.g., <filename
  60. class="devicefile">sda5</filename>). This book will refer to this as
  61. the LFS partition. Also remember the designation of the <systemitem
  62. class="filesystem">swap</systemitem> partition. These names will be
  63. needed later for the <filename>/etc/fstab</filename> file.</para>
  64. <sect2>
  65. <title>Other Partition Issues</title>
  66. <para>Requests for advice on system partitioning are often posted on the LFS mailing
  67. lists. This is a highly subjective topic. The default for most distributions
  68. is to use the entire drive with the exception of one small swap partition. This
  69. is not optimal for LFS for several reasons. It reduces flexibility, makes
  70. sharing of data across multiple distributions or LFS builds more difficult, makes
  71. backups more time consuming, and can waste disk space through inefficient
  72. allocation of file system structures.</para>
  73. <sect3>
  74. <title>The Root Partition</title>
  75. <para>A root LFS partition (not to be confused with the
  76. <filename class="directory">/root</filename> directory) of
  77. ten gigabytes is a good compromise for most systems. It provides enough
  78. space to build LFS and most of BLFS, but is small enough so that multiple
  79. partitions can be easily created for experimentation.</para> </sect3>
  80. <sect3>
  81. <title>The Swap Partition</title>
  82. <para>Most distributions automatically create a swap partition. Generally
  83. the recommended size of the swap partition is about twice the amount of
  84. physical RAM, however this is rarely needed. If disk space is limited,
  85. hold the swap partition to two gigabytes and monitor the amount of disk
  86. swapping.</para>
  87. <para>Swapping is never good. Generally you can tell if a system is
  88. swapping by just listening to disk activity and observing how the system
  89. reacts to commands. The first reaction to swapping should be to check for
  90. an unreasonable command such as trying to edit a five gigabyte file. If
  91. swapping becomes a normal occurrence, the best solution is to purchase more
  92. RAM for your system.</para>
  93. </sect3>
  94. <sect3>
  95. <title>The Grub Bios Partition</title>
  96. <para>If the <emphasis>boot disk</emphasis> has been partitioned with a
  97. GUID Partition Table (GPT), then a small, typically 1 MB, partition must be
  98. created if it does not already exist. This partition is not formatted, but
  99. must be available for GRUB to use during installation of the boot
  100. loader. This partition will normally be labeled 'BIOS Boot' if using
  101. <command>fdisk</command> or have a code of <emphasis>EF02</emphasis> if
  102. using <command>gdisk</command>.</para>
  103. <note><para>The Grub Bios partition must be on the drive that the BIOS
  104. uses to boot the system. This is not necessarily the same drive where the
  105. LFS root partition is located. Disks on a system may use different
  106. partition table types. The requirment for this partition depends
  107. only on the partition table type of the boot disk.</para></note>
  108. </sect3>
  109. <sect3>
  110. <title>Convenience Partitions</title>
  111. <para>There are several other partitions that are not required, but should
  112. be considered when designing a disk layout. The following list
  113. is not comprehensive, but is meant as a guide.</para>
  114. <itemizedlist>
  115. <listitem><para>/boot &ndash; Highly recommended. Use this partition to
  116. store kernels and other booting information. To minimize potential boot
  117. problems with larger disks, make this the first physical partition on
  118. your first disk drive. A partition size of 100 megabytes is quite
  119. adequate.</para></listitem>
  120. <listitem><para>/home &ndash; Highly recommended. Share your home
  121. directory and user customization across multiple distributions or LFS
  122. builds. The size is generally fairly large and depends on available disk
  123. space.</para></listitem>
  124. <listitem><para>/usr &ndash; A separate /usr partition is generally used
  125. if providing a server for a thin client or diskless workstation. It is
  126. normally not needed for LFS. A size of five gigabytes will handle most
  127. installations.</para></listitem>
  128. <listitem><para>/opt &ndash; This directory is most useful for
  129. BLFS where multiple installations of large packages like Gnome or KDE can
  130. be installed without embedding the files in the /usr hierarchy. If
  131. used, 5 to 10 gigabytes is generally adequate.</para>
  132. </listitem>
  133. <listitem><para>/tmp &ndash; A separate /tmp directory is rare, but
  134. useful if configuring a thin client. This partition, if used, will
  135. usually not need to exceed a couple of gigabytes.</para></listitem>
  136. <listitem><para>/usr/src &ndash; This partition is very
  137. useful for providing a location to store BLFS source files and
  138. share them across LFS builds. It can also be used as a location
  139. for building BLFS packages. A reasonably large partition of 30-50
  140. gigabytes allows plenty of room.</para></listitem>
  141. </itemizedlist>
  142. <para>Any separate partition that you want automatically mounted upon boot
  143. needs to be specified in the <filename>/etc/fstab</filename>. Details
  144. about how to specify partitions will be discussed in <xref
  145. linkend="ch-bootable-fstab"/>. </para>
  146. </sect3>
  147. </sect2>
  148. </sect1>