summaryrefslogtreecommitdiffstats
path: root/slackbook/html/installation-partitioning.html
blob: 3d3821e5e56dcf98ba23a1b3b326a9e00f419378 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<title>Partitioning</title>
<meta name="GENERATOR" content="Modular DocBook HTML Stylesheet Version 1.7" />
<link rel="HOME" title="Slackware Linux Essentials" href="index.html" />
<link rel="UP" title="Installation" href="installation.html" />
<link rel="PREVIOUS" title="System Requirements" href="installation-requirements.html" />
<link rel="NEXT" title="The setup Program" href="installation-setup.html" />
<link rel="STYLESHEET" type="text/css" href="docbook.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body class="SECT1" bgcolor="#FFFFFF" text="#000000" link="#0000FF" vlink="#840084"
alink="#0000FF">
<div class="NAVHEADER">
<table summary="Header navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<th colspan="3" align="center">Slackware Linux Essentials</th>
</tr>

<tr>
<td width="10%" align="left" valign="bottom"><a href="installation-requirements.html"
accesskey="P">Prev</a></td>
<td width="80%" align="center" valign="bottom">Chapter 3 Installation</td>
<td width="10%" align="right" valign="bottom"><a href="installation-setup.html"
accesskey="N">Next</a></td>
</tr>
</table>

<hr align="LEFT" width="100%" />
</div>

<div class="SECT1">
<h1 class="SECT1"><a id="INSTALLATION-PARTITIONING" name="INSTALLATION-PARTITIONING">3.3
Partitioning</a></h1>

<p>After booting from your preferred media, you will need to partition your hard disk.
The disk partition is where the Linux filesystem will be created and is where Slackware
will be installed. At the very minimum we recommend creating two partitions; one for your
root filesystem (<tt class="FILENAME">/</tt>) and one for swap space.</p>

<p>After the root disk finishes loading, it will present you with a login prompt. Log in
as root (there is no password). At the shell prompt, run either <tt
class="COMMAND">cfdisk</tt>(8) or <tt class="COMMAND">fdisk</tt>(8). The <tt
class="COMMAND">cfdisk</tt> program provides a more user-friendly interface than the
regular <tt class="COMMAND">fdisk</tt> program, but does lack some features. We will
briefly explain the <tt class="COMMAND">fdisk</tt> program below.</p>

<p>Begin by running <tt class="COMMAND">fdisk</tt> for your hard disk. In Linux, the hard
disks do not have drive letters, but are represented by a file. The first IDE hard disk
(primary master) is <tt class="FILENAME">/dev/hda</tt>, the primary slave is <tt
class="FILENAME">/dev/hdb</tt>, and so on. SCSI disks follow the same type system, but
are in the form of <tt class="FILENAME">/dev/sd<var class="REPLACEABLE">X</var></tt>. You
will need to start <tt class="COMMAND">fdisk</tt> and pass it your hard disk:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
<samp class="PROMPT">#</samp> <kbd class="USERINPUT">fdisk /dev/hda</kbd>
</pre>
</td>
</tr>
</table>

<p>Like all good Unix programs, <tt class="COMMAND">fdisk</tt> gives you a prompt
(thought you were getting a menu, right?). The first thing you should do is examine your
current partitions. We do that by typing <kbd class="USERINPUT">p</kbd> at the <tt
class="COMMAND">fdisk</tt> prompt:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help): <kbd class="USERINPUT">p</kbd>
</pre>
</td>
</tr>
</table>

<p>This will display all sorts of information about your current partitions. Most people
pick a free drive to install to and then remove any existing partitions on it to create
room for the Linux partitions.</p>

<div class="WARNING">
<table class="WARNING" width="100%" border="0">
<tr>
<td width="25" align="CENTER" valign="TOP"><img src="./imagelib/admon/warning.png"
hspace="5" alt="Warning" /></td>
<td align="LEFT" valign="TOP">
<p>IT IS VERY IMPORTANT THAT YOU BACK UP ANY INFORMATION YOU WANT TO SAVE BEFORE
DESTROYING THE PARTITION IT LIVES ON.</p>
</td>
</tr>
</table>
</div>

<p>There is no easy way to recover from deleting a partition, so always back up before
playing with them.</p>

<p>Looking at the table of partition information you should see a partition number, the
size of the partition, and its type. There's more information, but don't worry about that
for now. We are going to delete all of the partitions on this drive to create the Linux
ones. We run the <kbd class="USERINPUT">d</kbd> command to delete those:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help): <kbd class="USERINPUT">d</kbd>
Partition number (1-4): <kbd class="USERINPUT">1</kbd>
</pre>
</td>
</tr>
</table>

<p>This process should be continued for each of the partitions. After deleting the
partitions we are ready to create the Linux ones. We have decided to create one partition
for our root filesystem and one for swap. It is worth noting that Unix partitioning
schemes are the subject of many flame wars, and that most users will tell you the best
way to do it. At a minimum, you should create one partition for <tt
class="FILENAME">/</tt> and one for swap. Over time, you'll develop a method that works
well for you.</p>

<p>I use two basic partition schemes. The first is for a desktop. I make 4 partitions,
<tt class="FILENAME">/</tt>, <tt class="FILENAME">/home</tt>, <tt
class="FILENAME">/usr/local</tt>, and swap. This lets me re-install or upgrade the entire
installation under <tt class="FILENAME">/</tt> without wiping out my data files under
/home or my custom compiled applications under <tt class="FILENAME">/usr/local</tt>. For
servers, I often replace the <tt class="FILENAME">/usr/local</tt> partition with a <tt
class="FILENAME">/var</tt> partition. Many different servers store information on that
partition and having it kept separate from <tt class="FILENAME">/</tt> has certain
performance benefits. For now, we're sticking with just two partitions: <tt
class="FILENAME">/</tt> and swap.</p>

<p>Now we create the partitions with the <kbd class="USERINPUT">n</kbd> command:</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help): <kbd class="USERINPUT">n</kbd>
Command action
   e   extended
   p   primary partition (1-4)
<kbd class="USERINPUT">p</kbd>
Partition number (1-4):<kbd class="USERINPUT">1</kbd>
First cylinder (0-1060, default 0):<kbd class="USERINPUT">0</kbd>
 Last cylinder or +size or +sizeM or +sizeK (0-1060, default 1060):<kbd
class="USERINPUT">+64M</kbd>
</pre>
</td>
</tr>
</table>

<p>You need to make sure you create primary partitions. The first partition is going to
be our swap partition. We tell fdisk to make partition number 1 a primary partition. We
start it at cylinder 0 and for the ending cylinder we type +64M. This will give us a 64
megabyte partition for swap. (The size of the swap partition you need actually depends on
the amount of RAM you have. It is conventional wisdom that a swap space double the size
of your RAM should be created.) Then we define primary partition number 2 starting at the
first available cylinder and going all the way to the end of the drive.</p>

<table border="0" bgcolor="#E0E0E0" width="100%">
<tr>
<td>
<pre class="SCREEN">
Command (m for help):<kbd class="USERINPUT">n</kbd>
Command action
   e   extended
   p   primary partition (1-4)
<kbd class="USERINPUT">p</kbd>
Partition number (1-4):<kbd class="USERINPUT">2</kbd>
First cylinder (124-1060, default 124):<kbd class="USERINPUT">124</kbd>
Last cylinder or +size or +sizeM or +sizeK (124-1060, default 1060):<kbd
class="USERINPUT">1060</kbd>
</pre>
</td>
</tr>
</table>

<p>We are almost done. We need to change the type of the first partition to type 82
(Linux swap). Type <kbd class="USERINPUT">t</kbd> to change the type, select the first
partition, and type <var class="LITERAL">82</var>. Before writing your changes to the
disk, you should look at the new partition table one last time. Use the <kbd
class="USERINPUT">p</kbd> in <tt class="COMMAND">fdisk</tt> to display the partition
table. If everything looks good, type <kbd class="USERINPUT">w</kbd> to write your
changes to the disk and quit <tt class="COMMAND">fdisk</tt>.</p>
</div>

<div class="NAVFOOTER">
<hr align="LEFT" width="100%" />
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0"
cellspacing="0">
<tr>
<td width="33%" align="left" valign="top"><a href="installation-requirements.html"
accesskey="P">Prev</a></td>
<td width="34%" align="center" valign="top"><a href="index.html"
accesskey="H">Home</a></td>
<td width="33%" align="right" valign="top"><a href="installation-setup.html"
accesskey="N">Next</a></td>
</tr>

<tr>
<td width="33%" align="left" valign="top">System Requirements</td>
<td width="34%" align="center" valign="top"><a href="installation.html"
accesskey="U">Up</a></td>
<td width="33%" align="right" valign="top">The <tt class="COMMAND">setup</tt>
Program</td>
</tr>
</table>
</div>
</body>
</html>