creatingpartition.xml 8.7 KB

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