slackware-current/slackbook/html/installation-partitioning.html
Patrick J Volkerding 75a4a592e5 Slackware 13.37
Mon Apr 25 13:37:00 UTC 2011
Slackware 13.37 x86_64 stable is released!

Thanks to everyone who pitched in on this release: the Slackware team,
the folks producing upstream code, and linuxquestions.org for providing
a great forum for collaboration and testing.

The ISOs are off to be replicated, a 6 CD-ROM 32-bit set and a
dual-sided
32-bit/64-bit x86/x86_64 DVD.  Please consider supporting the Slackware
project by picking up a copy from store.slackware.com.  We're taking
pre-orders now, and offer a discount if you sign up for a subscription.

As always, thanks to the Slackware community for testing, suggestions,
and feedback.  :-)

Have fun!
2018-05-31 22:45:18 +02:00

218 lines
8.9 KiB
HTML

<!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>