Gentoo Archives: gentoo-doc-cvs

From: "Sven Vermeulen (swift)" <swift@g.o>
To: gentoo-doc-cvs@l.g.o
Subject: [gentoo-doc-cvs] gentoo commit in xml/htdocs/doc/en/handbook: hb-install-x86+amd64-disk.xml
Date: Tue, 23 Aug 2011 17:31:45
Message-Id: 20110823173134.213AD2004C@flycatcher.gentoo.org
1 swift 11/08/23 17:31:34
2
3 Modified: hb-install-x86+amd64-disk.xml
4 Log:
5 Fix bug #370479 - Introduce partitioning with parted too (at least for x86/amd64) and mention the use case of >2TB
6
7 Revision Changes Path
8 1.15 xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml
9
10 file : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml?rev=1.15&view=markup
11 plain: http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml?rev=1.15&content-type=text/plain
12 diff : http://sources.gentoo.org/viewvc.cgi/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml?r1=1.14&r2=1.15
13
14 Index: hb-install-x86+amd64-disk.xml
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml,v
17 retrieving revision 1.14
18 retrieving revision 1.15
19 diff -u -r1.14 -r1.15
20 --- hb-install-x86+amd64-disk.xml 22 Aug 2011 17:18:23 -0000 1.14
21 +++ hb-install-x86+amd64-disk.xml 23 Aug 2011 17:31:34 -0000 1.15
22 @@ -4,7 +4,7 @@
23 <!-- The content of this document is licensed under the CC-BY-SA license -->
24 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
25
26 -<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml,v 1.14 2011/08/22 17:18:23 swift Exp $ -->
27 +<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-install-x86+amd64-disk.xml,v 1.15 2011/08/23 17:31:34 swift Exp $ -->
28
29 <sections>
30
31 @@ -13,8 +13,8 @@
32 This chapter describes how to partition a disk for future usage.
33 </abstract>
34
35 -<version>7</version>
36 -<date>2011-08-22</date>
37 +<version>8</version>
38 +<date>2011-08-23</date>
39
40 <section>
41 <title>Introduction to Block Devices</title>
42 @@ -118,7 +118,10 @@
43 If you are interested in knowing how big a partition should be, or even how
44 many partitions you need, read on. Otherwise continue now with partitioning
45 your disk by reading <uri link="#fdisk">Using fdisk to Partition your
46 -Disk</uri>.
47 +Disk</uri> or <uri link="#parted">Using parted to Partition your Disk</uri>
48 +(both are partitioning tools, <c>fdisk</c> is well known and stable,
49 +<c>parted</c> is a bit more recent but supports partitions larger than
50 +2TB).
51 </p>
52
53 </body>
54 @@ -209,9 +212,16 @@
55 <subsection>
56 <body>
57
58 +<impo>
59 +If your environment will deal with partitions larger than 2 TB, please
60 +use the <uri link="#parted">Using parted to Partition your Disk</uri>
61 +instructions instead. <c>fdisk</c> is not able to deal with larger
62 +partitions.
63 +</impo>
64 +
65 <p>
66 The following parts explain how to create the example partition layout
67 -described previously, namely:
68 +using <c>fdisk</c>. The example partition layout was mentioned earlier:
69 </p>
70
71 <table>
72 @@ -466,6 +476,204 @@
73 </body>
74 </subsection>
75 </section>
76 +<section id="parted">
77 +<title>Using parted to Partition your Disk</title>
78 +<subsection>
79 +<body>
80 +
81 +<p>
82 +In this chapter, we guide you through the creation of the example partition
83 +layout mentioned earlier in the instructions. Unlike the previous chapter, we
84 +describe the method using the <c>parted</c> application instead. Both
85 +<c>parted</c> and <c>fdisk</c> offer the same functions, so if you partitioned
86 +your system using <c>fdisk</c> already, you can skip this section and continue
87 +with <uri link="#filesystems">Creating Filesystems</uri>.
88 +</p>
89 +
90 +<p>
91 +The example partition layout we use is shown in the next table:
92 +</p>
93 +
94 +<table>
95 +<tr>
96 + <th>Partition</th>
97 + <th>Description</th>
98 +</tr>
99 +<tr>
100 + <ti><path>/dev/sda1</path></ti>
101 + <ti>Boot partition</ti>
102 +</tr>
103 +<tr>
104 + <ti><path>/dev/sda2</path></ti>
105 + <ti>Swap partition</ti>
106 +</tr>
107 +<tr>
108 + <ti><path>/dev/sda3</path></ti>
109 + <ti>Root partition</ti>
110 +</tr>
111 +</table>
112 +
113 +<p>
114 +Change your partition layout according to your own preference.
115 +</p>
116 +
117 +</body>
118 +</subsection>
119 +<subsection>
120 +<title>Viewing the Current Partition Layout</title>
121 +<body>
122 +
123 +<p>
124 +The <c>parted</c> application is a somewhat more modern variant of
125 +<c>fdisk</c>. It offers a simpler interface for partitioning your disks and
126 +supports very large partitions (more than 2 TB). Fire up <c>parted</c> on your
127 +disk (in our example, we use <path>/dev/sda</path>):
128 +</p>
129 +
130 +<pre caption="Starting parted">
131 +# <i>parted /dev/sda</i>
132 +GNU Parted 2.3
133 +Using /dev/vda
134 +Welcome to GNU Parted! Type 'help' to view a list of commands.
135 +</pre>
136 +
137 +<p>
138 +To find out about all options supported by <c>parted</c>, type <c>help</c> and
139 +press return. For now, we just continue by asking <c>parted</c> to show the
140 +partitions currently in use on the selected disk. The <c>print</c> command can
141 +be used for that.
142 +</p>
143 +
144 +<pre caption="An example partition configuration shown by parted">
145 +(parted) <i>print</i>
146 +Model: SCSI Block Device
147 +Disk /dev/sda: 21.5GB
148 +Sector size (logical/physical): 512B/512B
149 +Partition Table: msdos
150 +
151 +Number Start End Size Type File system Flags
152 + 1 512B 2148MB 2148MB primary ext4
153 + 2 2148MB 3222MB 1074MB primary linux-swap(v1)
154 + 3 3222MB 21.5GB 18.3GB primary lvm
155 +</pre>
156 +
157 +</body>
158 +</subsection>
159 +<subsection>
160 +<title>Optional: Setting the GPT Label</title>
161 +<body>
162 +
163 +<p>
164 +Most disks on x86/amd64 are prepared using an <e>msdos</e> label. However, if
165 +you plan on creating huge partitions (2 TB and more), you must use a <e>gpt</e>
166 +label (the <e>GUID Partition Type</e>) for your disk. Using <c>parted</c>, this
167 +can be accomplished with <c>mklabel gpt</c>:
168 +</p>
169 +
170 +<warn>
171 +Changing the partition type will remove all partitions from your disk. All data
172 +on the disk will be lost.
173 +</warn>
174 +
175 +<pre caption="Setting the GPT label">
176 +(parted) <i>mklabel gpt</i>
177 +</pre>
178 +
179 +</body>
180 +</subsection>
181 +<subsection>
182 +<title>Removing all Partitions</title>
183 +<body>
184 +
185 +<p>
186 +If this isn't done yet (for instance through the <c>mklabel</c> operation
187 +earlier, or because the disk is a freshly formatted one), we will first
188 +remove all existing partitions from the disk. Type <c>rm &lt;number&gt;</c>
189 +where &lt;number&gt; is the partition you want to remove.
190 +</p>
191 +
192 +<pre caption="Removing a partition from the disk">
193 +(parted) <i>rm 2</i>
194 +</pre>
195 +
196 +<p>
197 +Do the same for all other partitions that you don't need. However, make sure you
198 +do not make any mistakes here - <c>parted</c> executes the changes immediate
199 +(unlike <c>fdisk</c> which stages them, allowing a user to "undo" his changes
200 +before saving or exiting <c>fdisk</c>).
201 +</p>
202 +
203 +</body>
204 +</subsection>
205 +<subsection>
206 +<title>Creating the Partitions</title>
207 +<body>
208 +
209 +<p>
210 +Now let's create the partitions we mentioned earlier. Creating partitions with
211 +<c>parted</c> isn't very difficult - all we need to do is inform <c>parted</c>
212 +about the following settings:
213 +</p>
214 +
215 +<ul>
216 + <li>
217 + The <e>partition type</e> to use. This usually is <e>primary</e> in case you
218 + are not going to have more than 4 partitions (with the <e>msdos</e>
219 + partition label). Otherwise, you will need to make your fourth partition an
220 + <e>extended</e> one which hosts the rest of the disk, and create
221 + <e>logical</e> partitions inside it. If you use a <e>gpt</e>-labeled
222 + partition, then there is no limit on the number of primary partitions.
223 + </li>
224 + <li>
225 + The <e>file system type</e> to use. The <c>parted</c> application supports
226 + most common file systems and knows which kind of partition ID it needs to
227 + use for these partitions. This does <e>not</e> mean that <c>parted</c> will
228 + create a file system on the partition (you can with the <c>mkpartfs</c>
229 + command, but we'll use the regular <c>mkfs.*</c> commands later for this
230 + purpose). The partition ID is often used by auto-detection tools to know
231 + what to do with a particular partition.
232 + </li>
233 + <li>
234 + The start location of a partition (which can be expressed in MB or GB)
235 + </li>
236 + <li>
237 + The end location of the partition (which can be expressed in MB or GB)
238 + </li>
239 +</ul>
240 +
241 +<p>
242 +One advantage of <c>parted</c> is that you can easily just use the partition
243 +sizes to automatically find the correct start and end location as you will see
244 +in the next example.
245 +</p>
246 +
247 +<pre caption="Creating the partitions">
248 +<comment># Create a 32 mbyte /boot partition</comment>
249 +(parted) <i>mkpart primary ext2 0 32mb</i>
250 +Warning: The resulting partition is not properly aligned for best performance.
251 +Ignore/Cancel? <i>i</i>
252 +
253 +<comment># Create a 512 mbyte swap partition</comment>
254 +(parted) <i>mkpart primary linux-swap 32mb 542mb</i>
255 +
256 +<comment># Create a partition that spans the remaining disk.
257 +# -1s (minus one s) means the end of the disk</comment>
258 +(parted) <i>mkpart primary ext4 542mb -1s</i>
259 +Warning: You requested a partition from 542MB to 21.5GB.
260 +The closest location we can manage is 542MB to 21.5GB.
261 +Is this still acceptable to you?
262 +Yes/No? <i>y</i>
263 +</pre>
264 +
265 +<p>
266 +You can now <c>print</c> the partition layout again to validate if everything is
267 +as expected. When you are satisfied, use the <c>quit</c> command to exit
268 +<c>parted</c>.
269 +</p>
270 +
271 +</body>
272 +</subsection>
273 +</section>
274 <section id="filesystems">
275 <title>Creating Filesystems</title>
276 <subsection>