creatingpartition.xml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  1. <?xml version="1.0" encoding="UTF-8"?>
  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>创建新的分区</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>像其他操作系统那样,LFS 一般也被安装在一个指定的分区。
  15. 我们推荐您为 LFS 选择一个可用的空分区,
  16. 或者在有充足未划分空间的情况下,创建一个新分区。</para>
  17. <!--
  18. <para>It is possible to install an LFS system (in fact even multiple LFS
  19. systems) on a partition already occupied by another
  20. operating system and the different systems will co-exist peacefully. The
  21. document <ulink url="&hints-root;lfs_next_to_existing_systems.txt"/>
  22. contains notes on how to implement this. This document was last updated
  23. in 2004. It has not been updated since and it has not been tested with
  24. recent versions of this LFS book. The document is more than likely not
  25. usable as-is and you will need to account for changes made to the LFS
  26. procedures since it was written. This is only recommended for expert LFS
  27. users.</para>
  28. -->
  29. <!--para>A minimal system requires a partition of around 6 gigabytes (GB).
  30. This is enough to store all the source tarballs and compile the packages.
  31. However, if the LFS system is intended to be the primary Linux system,
  32. additional software will probably be installed which will require additional
  33. space. A 20 GB partition is a reasonable size to provide for growth. The LFS
  34. system itself will not take up this much room. A large portion of this
  35. requirement is to provide sufficient free temporary storage as well as
  36. for adding additional capabilities after LFS is complete. Additionally, compiling
  37. packages can require a lot of disk space which will be reclaimed after the
  38. package is installed.</para-->
  39. <para>一个最小的系统需要大小约 6 吉字节 (GB) 的分区。
  40. 这足够保存所有源代码压缩包,并且编译所有软件包。
  41. 然而,如果希望用 LFS 作为日常的 Linux 系统,很可能需要安装额外软件,
  42. 需要更多空间。一个 20 GB 的分区是比较合理的,
  43. LFS 系统本身用不了太多空间,但大分区可以提供足够的临时存储空间,
  44. 以及在 LFS 构建完成后增添附加功能需要的空间。
  45. 另外,编译软件包可能需要大量磁盘空间,
  46. 但在软件包安装完成后可以回收这些空间。</para>
  47. <!--para>Because there is not always enough Random Access Memory (RAM) available
  48. for compilation processes, it is a good idea to use a small disk partition as
  49. <systemitem class="filesystem">swap</systemitem> space. This is used by the
  50. kernel to store seldom-used data and leave more memory available for active
  51. processes. The <systemitem class="filesystem">swap</systemitem> partition for
  52. an LFS system can be the same as the one used by the host system, in which
  53. case it is not necessary to create another one.</para-->
  54. <para>计算机未必有足够满足编译过程要求的内存 (RAM) 空间,
  55. 因此可以使用一个小的磁盘分区作为
  56. <systemitem class="filesystem">swap</systemitem> 空间。
  57. 内核使用此分区存储很少使用的数据,从而为活动进程留出更多内存。
  58. LFS 的 <systemitem class="filesystem">swap</systemitem>
  59. 分区可以和宿主系统共用,这样就不用专门为 LFS 创建一个。</para>
  60. <!--para>Start a disk partitioning program such as <command>cfdisk</command>
  61. or <command>fdisk</command> with a command line option naming the hard
  62. disk on which the new partition will be created&mdash;for example
  63. <filename class="devicefile">/dev/sda</filename> for the primary
  64. disk drive. Create a Linux native partition and a
  65. <systemitem class="filesystem">swap</systemitem> partition, if needed. Please
  66. refer to <filename>cfdisk(8)</filename> or <filename>fdisk(8)</filename> if
  67. you do not yet know how to use the programs.</para-->
  68. <para>启动一个磁盘分区程序,例如 <command>cfdisk</command>
  69. 或者<command>fdisk</command>。在启动分区程序时需要一个命令行参数,
  70. 表示希望创建新分区的硬盘,例如主硬盘
  71. <filename class="devicefile">/dev/sda</filename>。
  72. 创建一个 Linux 本地分区,如果有必要的话再创建一个
  73. <systemitem class="filesystem">swap</systemitem> 分区。
  74. 请参考 <filename>cfdisk(8)</filename> 或者
  75. <filename>fdisk(8)</filename> 来学习如何使用分区程序。</para>
  76. <!--note><para>For experienced users, other partitioning schemes are possible.
  77. The new LFS system can be on a software <ulink
  78. url="&blfs-book;postlfs/raid.html">RAID</ulink> array or an <ulink
  79. url="&blfs-book;postlfs/aboutlvm.html">LVM</ulink> logical volume.
  80. However, some of these options require an <ulink
  81. url="&blfs-book;postlfs/initramfs.html">initramfs</ulink>, which is
  82. an advanced topic. These partitioning methodologies are not recommended for
  83. first time LFS users.</para></note-->
  84. <note><para>有经验的用户可以尝试其他分区架构。
  85. LFS 系统可以被构建在软件
  86. <ulink url="&blfs-book;postlfs/raid.html">RAID</ulink> 阵列或
  87. <ulink url="&blfs-book;postlfs/aboutlvm.html">LVM</ulink>
  88. 逻辑卷上。然而,一些分区架构需要
  89. <ulink url="&blfs-book;postlfs/initramfs.html">initramfs</ulink>,
  90. 这是一个比较复杂的话题。对于初次构建 LFS 的用户来说,
  91. 不推荐采用这些分区方法。</para></note>
  92. <!--para>Remember the designation of the new partition (e.g., <filename
  93. class="devicefile">sda5</filename>). This book will refer to this as
  94. the LFS partition. Also remember the designation of the <systemitem
  95. class="filesystem">swap</systemitem> partition. These names will be
  96. needed later for the <filename>/etc/fstab</filename> file.</para-->
  97. <para>牢记新分区的代号 (例如
  98. <filename class="devicefile">sda5</filename> )。
  99. 本书将这个分区称为 LFS 分区。还需要记住
  100. <systemitem class="filesystem">swap</systemitem> 分区的代号。
  101. 之后在设置 <filename>/etc/fstab</filename> 文件时要用到这些代号。
  102. </para>
  103. <sect2>
  104. <title>其他分区问题</title>
  105. <!--para>Requests for advice on system partitioning are often posted on the LFS mailing
  106. lists. This is a highly subjective topic. The default for most distributions
  107. is to use the entire drive with the exception of one small swap partition. This
  108. is not optimal for LFS for several reasons. It reduces flexibility, makes
  109. sharing of data across multiple distributions or LFS builds more difficult, makes
  110. backups more time consuming, and can waste disk space through inefficient
  111. allocation of file system structures.</para-->
  112. <para>经常有人在 LFS 邮件列表询问如何进行系统分区,
  113. 这是一个相当主观的问题。许多发行版在默认情况下会使用整个磁盘,
  114. 只留下一个小的 <systemitem class="filesystem"> swap </systemitem>
  115. 分区。对于 LFS 来说,这往往不是最好的方案。它削弱了系统的灵活性,
  116. 使得我们难以在多个发行版或 LFS 系统之间共享数据,增加系统备份时间,
  117. 同时导致文件系统结构的不合理分配,浪费磁盘空间。</para>
  118. <sect3>
  119. <title>根分区</title>
  120. <!--para>A root LFS partition (not to be confused with the
  121. <filename class="directory">/root</filename> directory) of
  122. ten gigabytes is a good compromise for most systems. It provides enough
  123. space to build LFS and most of BLFS, but is small enough so that multiple
  124. partitions can be easily created for experimentation.</para-->
  125. <para>一个 LFS 根分区 (不要与
  126. <filename class="directory">/root</filename> 目录混淆) 一般分配
  127. 10 GB 的空间就足以保证多数系统的运行。它提供了构建 LFS 以及 BLFS
  128. 的大部分软件包的充足空间,但又不太大,因此能够创建多个分区,
  129. 多次尝试构建 LFS 系统。</para>
  130. </sect3>
  131. <sect3>
  132. <title>交换 (Swap) 分区</title>
  133. <!--para>Most distributions automatically create a swap partition. Generally
  134. the recommended size of the swap partition is about twice the amount of
  135. physical RAM, however this is rarely needed. If disk space is limited,
  136. hold the swap partition to two gigabytes and monitor the amount of disk
  137. swapping.</para-->
  138. <para>许多发行版自动创建交换空间。
  139. 一般来说,推荐采用两倍于物理内存的交换空间,然而这几乎没有必要。
  140. 如果磁盘空间有限,可以创建 2GB 的交换空间,并注意它的使用情况。
  141. </para>
  142. <!--para>Swapping is never good. Generally you can tell if a system is
  143. swapping by just listening to disk activity and observing how the system
  144. reacts to commands. The first reaction to swapping should be to check for
  145. an unreasonable command such as trying to edit a five gigabyte file. If
  146. swapping becomes a normal occurrence, the best solution is to purchase more
  147. RAM for your system.</para-->
  148. <para>交换到磁盘从来就不是一件好事。一般来说,听硬盘的工作噪声,
  149. 同时观察系统的响应速度,就能说出系统是否在交换。一旦发生交换,
  150. 首先检查是否输入了不合理的命令,例如试图编辑一个 5GB 的文件。
  151. 如果交换时常发生,最好的办法是为你的系统添置内存。</para>
  152. </sect3>
  153. <sect3>
  154. <title>Grub Bios 分区</title>
  155. <!--para>If the <emphasis>boot disk</emphasis> has been partitioned with a
  156. GUID Partition Table (GPT), then a small, typically 1 MB, partition must be
  157. created if it does not already exist. This partition is not formatted, but
  158. must be available for GRUB to use during installation of the boot
  159. loader. This partition will normally be labeled 'BIOS Boot' if using
  160. <command>fdisk</command> or have a code of <emphasis>EF02</emphasis> if
  161. using <command>gdisk</command>.</para-->
  162. <para>如果 <emphasis>启动磁盘</emphasis> 采用 GUID 分区表 (GPT),
  163. 那么必须创建一个小的,一般占据 1MB 的分区,除非它已经存在。
  164. 这个分区不能格式化,在安装启动引导器时必须能够被 GRUB 发现。
  165. 这个分区在 <command>fdisk</command> 下显示为 'BIOS Boot' 分区,
  166. 在 <command>gdisk</command> 下显示分区类型代号为
  167. <emphasis>EF02</emphasis>。</para>
  168. <!--note><para>The Grub Bios partition must be on the drive that the BIOS
  169. uses to boot the system. This is not necessarily the same drive where the
  170. LFS root partition is located. Disks on a system may use different
  171. partition table types. The requirement for this partition depends
  172. only on the partition table type of the boot disk.</para></note-->
  173. <note><para> Grub Bios 分区必须位于 BIOS 引导系统使用的磁盘上。
  174. 这个磁盘未必是 LFS 根分区所在的磁盘。
  175. 不同磁盘可以使用不同分区表格式,只有引导盘采用 GPT
  176. 时才必须创建该分区。</para></note>
  177. <note>
  178. <title>译注</title>
  179. <para>
  180. 使用 GPT 磁盘的读者也可以选择使用 UEFI 引导系统,
  181. 但需要划分 EFI 分区,以及额外的软件包和配置。参见
  182. <ulink url="&hints-root;lfs-uefi.txt"/>。
  183. </para>
  184. </note>
  185. </sect3>
  186. <sect3>
  187. <title>常用分区</title>
  188. <!--para>There are several other partitions that are not required, but should
  189. be considered when designing a disk layout. The following list
  190. is not comprehensive, but is meant as a guide.</para-->
  191. <para>还有其他几个并非必须,但在设计磁盘布局时应当考虑的分区。
  192. 下面的列表并不完整,但可以作为一个参考。</para>
  193. <itemizedlist>
  194. <listitem><!--para>/boot &ndash; Highly recommended. Use this partition to
  195. store kernels and other booting information. To minimize potential boot
  196. problems with larger disks, make this the first physical partition on
  197. your first disk drive. A partition size of 100 megabytes is quite
  198. adequate.</para-->
  199. <para>/boot &ndash; 高度推荐。这个分区可以存储内核和其他引导信息。
  200. 为了减少大磁盘可能引起的问题,
  201. 建议将 /boot 分区设为第一块磁盘的第一个分区。为它分配 100 MB
  202. 就绰绰有余。</para>
  203. </listitem>
  204. <listitem><!--para>/home &ndash; Highly recommended. Share your home
  205. directory and user customization across multiple distributions or LFS
  206. builds. The size is generally fairly large and depends on available disk
  207. space.</para-->
  208. <para>/home &ndash; 高度推荐。独立的 /home 分区可以在多个发行版或 LFS
  209. 系统之间共享 home 目录和用户设置。它的尺寸一般很大,
  210. 取决于硬盘的可用空间。</para>
  211. </listitem>
  212. <listitem><!--para>/usr &ndash; A separate /usr partition is generally used
  213. if providing a server for a thin client or diskless workstation. It is
  214. normally not needed for LFS. A size of five gigabytes will handle most
  215. installations.</para-->
  216. <para>/usr &ndash; 一个独立的 /usr
  217. 分区一般被用于瘦客户端或无盘站的服务器,LFS 一般不需要。
  218. 为它划分 5GB 足够满足多数系统的要求。</para>
  219. </listitem>
  220. <listitem><!--para>/opt &ndash; This directory is most useful for
  221. BLFS where multiple installations of large packages like Gnome or KDE can
  222. be installed without embedding the files in the /usr hierarchy. If
  223. used, 5 to 10 gigabytes is generally adequate.</para-->
  224. <para>/opt &ndash; 这个目录往往被用于在 BLFS 中安装 Gnome 或 KDE
  225. 等大型软件,以免把大量文件塞进 /usr 目录树。
  226. 如果将它划分为独立分区,5 到 10 GB 一般就足够了。</para>
  227. </listitem>
  228. <listitem><!--para>/tmp &ndash; A separate /tmp directory is rare, but
  229. useful if configuring a thin client. This partition, if used, will
  230. usually not need to exceed a couple of gigabytes.</para-->
  231. <para>/tmp &ndash; 一个独立的 /tmp 分区是很少见的,
  232. 但在配置瘦客户端时很有用。如果分配了这个分区,
  233. 大小一般不会超过几个 GB 。</para>
  234. </listitem>
  235. <listitem><!--para>/usr/src &ndash; This partition is very
  236. useful for providing a location to store BLFS source files and
  237. share them across LFS builds. It can also be used as a location
  238. for building BLFS packages. A reasonably large partition of 30-50
  239. gigabytes allows plenty of room.</para-->
  240. <para>/usr/src &ndash; 将它划分为独立分区,可以用于存储 BLFS 源代码,
  241. 并在多个 LFS 系统之间共享它们。
  242. 它也可以用于编译 BLFS 软件包。30-50 GB 的分区可以提供足够的空间。
  243. </para>
  244. </listitem>
  245. </itemizedlist>
  246. <!--para>Any separate partition that you want automatically mounted upon boot
  247. needs to be specified in the <filename>/etc/fstab</filename>. Details
  248. about how to specify partitions will be discussed in <xref
  249. linkend="ch-bootable-fstab"/>. </para-->
  250. <para>如果您希望在启动时自动挂载任何一个独立的分区,就要在
  251. <filename>/etc/fstab</filename> 文件中说明。有关指定分区的细节将在
  252. <xref linkend="ch-bootable-fstab"/> 中讨论。 </para>
  253. </sect3>
  254. </sect2>
  255. </sect1>