214 lines
10 KiB
HTML
214 lines
10 KiB
HTML
<!DOCTYPE HTML PUBLIC "-//W3O//DTD W3 HTML 2.0//EN">
|
|
<!Converted with LaTeX2HTML 95.1 (Fri Jan 20 1995) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds >
|
|
<HEAD>
|
|
<TITLE>2.3.3 Creating Linux partitions</TITLE>
|
|
</HEAD>
|
|
<BODY>
|
|
<meta name="description" value="2.3.3 Creating Linux partitions">
|
|
<meta name="keywords" value="gs">
|
|
<meta name="resource-type" value="document">
|
|
<meta name="distribution" value="global">
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html2628 HREF="node74.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html2626 HREF="node70.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html2620 HREF="node72.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html2630 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html2631 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html2629 HREF="node74.html">2.3.4 Creating the swap </A>
|
|
<B>Up:</B> <A NAME=tex2html2627 HREF="node70.html">2.3 Installing the Linux </A>
|
|
<B> Previous:</B> <A NAME=tex2html2621 HREF="node72.html">2.3.2 Drives and partitions </A>
|
|
<BR> <HR> <P>
|
|
<H2><A NAME=SECTION00433000000000000000>2.3.3 Creating Linux partitions</A></H2>
|
|
<P>
|
|
<A NAME=secinstalllinuxfdisk> </A>
|
|
<P>
|
|
<A NAME=1327> </A>
|
|
<A NAME=1328> </A>
|
|
<P>
|
|
Now you are ready to create Linux partitions with the <tt>fdisk</tt> command.
|
|
As described in Section <A HREF="node68.html#secinstalllinuxreqs">2.2.3</A>, in general you
|
|
will need to create at least one partition for the Linux software itself, and
|
|
another partition for swap space.
|
|
<P>
|
|
After booting the installation media, run <tt>fdisk</tt> by typing
|
|
<P><TT> fdisk <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img55.gif"> <P></TT>
|
|
where <IMG BORDER=0 ALIGN=BOTTOM ALT="" SRC="img56.gif"> is the Linux device name
|
|
of the drive you plan to add
|
|
partitions to (see Table <A HREF="node72.html#tablepartnames">2.1</A>).
|
|
For instance, if you want to run <tt>fdisk</tt>
|
|
on the first SCSI disk in your system, use the command <tt>fdisk /dev/sda</tt>.
|
|
<tt>/dev/hda</tt> (the first IDE drive) is the default if you don't specify one.
|
|
<P>
|
|
If you are creating Linux partitions on more than one drive, run <tt>fdisk</tt>
|
|
once for each drive.
|
|
<P>
|
|
<P><TT> # <em>fdisk /dev/hda</em>
|
|
<P>
|
|
Command (m for help):
|
|
<P></TT>
|
|
Here <tt>fdisk</tt> is waiting for a command; you can type <tt>m</tt> to get a
|
|
list of options.
|
|
<P><TT> Command (m for help): <em>m</em> <BR>
|
|
Command action <BR>
|
|
a toggle a bootable flag <BR>
|
|
d delete a partition <BR>
|
|
l list known partition types <BR>
|
|
m print this menu <BR>
|
|
n add a new partition <BR>
|
|
p print the partition table <BR>
|
|
q quit without saving changes <BR>
|
|
t change a partition's system id <BR>
|
|
u change display/entry units <BR>
|
|
v verify the partition table <BR>
|
|
w write table to disk and exit <BR>
|
|
x extra functionality (experts only)
|
|
<P>
|
|
Command (m for help):
|
|
<P></TT>
|
|
The <tt>n</tt> command is used to create a new partition.
|
|
Most of the other options you won't need to worry about. To quit
|
|
<tt>fdisk</tt> without saving any changes, use the <tt>q</tt> command. To quit
|
|
<tt>fdisk</tt> and write the changes to the partition table to disk, use the
|
|
<tt>w</tt> command.
|
|
<P>
|
|
The first thing you should do is display your current partition table
|
|
and write the information down, for later reference. Use the <tt>p</tt> command.
|
|
<P><TT> Command (m for help): <em>p</em> <BR>
|
|
Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders <BR>
|
|
Units = cylinders of 608 * 512 bytes
|
|
<PRE> Device Boot Begin Start End Blocks Id System
|
|
/dev/hda1 * 1 1 203 61693 6 DOS 16-bit >=32M
|
|
</PRE>
|
|
Command (m for help):
|
|
<P></TT>
|
|
In this example, we have a single MS-DOS partition on <tt>/dev/hda1</tt>, which
|
|
is 61693 blocks (about 60 megs).<A NAME=tex2html264 HREF="footnode.html#1269"><IMG ALIGN=BOTTOM ALT="gif" SRC="foot_motif.gif"></A> This partition starts at cylinder number
|
|
1, and ends on cylinder 203. We have a total of 683 cylinders in this
|
|
disk; so there are 480 cylinders left to create Linux partitions on.
|
|
<P>
|
|
To create a new partition, use the <tt>n</tt> command. In this example, we'll
|
|
create two primary partitions (<tt>/dev/hda2</tt> and <tt>/dev/hda3</tt>)
|
|
for Linux.
|
|
<P>
|
|
<P><TT> Command (m for help): <em>n</em> <BR>
|
|
Command action <BR>
|
|
e extended <BR>
|
|
p primary partition (1-4) <BR>
|
|
<em>p</em>
|
|
<P></TT>
|
|
Here, <tt>fdisk</tt> is asking the type of the partition to create: extended
|
|
or primary. In our example, we're creating only primary partitions, so we
|
|
choose <tt>p</tt>.
|
|
<P><TT> Partition number (1-4):
|
|
<P></TT>
|
|
<tt>fdisk</tt> will then ask for the number of the partition to create;
|
|
since partition 1
|
|
is already used, our first Linux partition will be number 2.
|
|
<P><TT> Partition number (1-4): <em>2</em><BR>
|
|
First cylinder (204-683):
|
|
<P></TT>
|
|
Now enter the starting cylinder number of the partition. Since cylinders
|
|
204 through 683 are unused, we'll use the first available one (numbered 204).
|
|
There's no reason to leave empty space between partitions.
|
|
<P><TT> First cylinder (204-683): <em>204</em> <BR>
|
|
Last cylinder or +size or +sizeM or +sizeK (204-683):
|
|
<P></TT>
|
|
<tt>fdisk</tt> is asking for the size of the partition to create. We can
|
|
either specify an ending cylinder number, or a size in bytes, kilobytes,
|
|
or megabytes.
|
|
Since we want our partition to be 80 megs in size, we
|
|
specify <tt>+80M</tt>. When specifying a partition size in this way,
|
|
<tt>fdisk</tt> will round the actual partition size to the nearest number
|
|
of cylinders.
|
|
<P><TT> Last cylinder or +size or +sizeM or +sizeK (204-683): <em>+80M</em>
|
|
<P>
|
|
Warning: Linux cannot currently use 33090 sectors of this partition
|
|
<P></TT>
|
|
If you see a warning message such as this, it can be ignored.
|
|
<tt>fdisk</tt> prints the warning because it's an
|
|
older program, and dates before the time that Linux partitions were allowed to
|
|
be larger than 64 megabytes.
|
|
<P>
|
|
Now we're ready to create our second Linux partition. For sake of
|
|
demonstration, we'll create it with a size of 10 megabytes.
|
|
<P><TT> Command (m for help): <em>n</em> <BR>
|
|
Command action <BR>
|
|
e extended <BR>
|
|
p primary partition (1-4) <BR>
|
|
<em>p</em> <BR>
|
|
Partition number (1-4): <em>3</em> <BR>
|
|
First cylinder (474-683): <em>474</em> <BR>
|
|
Last cylinder or +size or +sizeM or +sizeK (474-683): <em>+10M</em>
|
|
<P></TT>
|
|
<P>
|
|
At last, we'll display the partition table. Again, write down all of
|
|
this information---especially the block sizes of your new partitions. You'll
|
|
need to know the sizes of the partitions when creating filesystems, later.
|
|
Also, verify that none of your partitions overlap.
|
|
<P><TT> Command (m for help): <em>p</em>
|
|
<P>
|
|
Disk /dev/hda: 16 heads, 38 sectors, 683 cylinders <BR>
|
|
Units = cylinders of 608 * 512 bytes
|
|
<PRE> Device Boot Begin Start End Blocks Id System
|
|
/dev/hda1 * 1 1 203 61693 6 DOS 16-bit >=32M
|
|
/dev/hda2 204 204 473 82080 81 Linux/MINIX
|
|
/dev/hda3 474 474 507 10336 81 Linux/MINIX
|
|
</PRE>
|
|
<P></TT>
|
|
As you can see, <tt>/dev/hda2</tt> is now a partition of size 82080 blocks
|
|
(which corresponds to about 80 megabytes), and <tt>/dev/hda3</tt> is
|
|
10336 blocks (about 10 megs).
|
|
<P>
|
|
Note that many distributions (such as Slackware) require you to use
|
|
the <tt>t</tt> command in <tt>fdisk</tt> to change the type of the swap
|
|
partition to ``Linux swap'', which is usually numbered 82. You can
|
|
use the <tt>L</tt> command to print a list of known partition type codes,
|
|
and then use <tt>t</tt> to set the type of the swap partition to that
|
|
which corresponds to ``Linux swap''.
|
|
<P>
|
|
In this way, the installation software will be able to automatically find
|
|
your swap partitions based on type. If the installation software doesn't
|
|
seem to recognize your swap partition, you might want to re-run
|
|
<tt>fdisk</tt> and use the <tt>t</tt> command on the partition in question.
|
|
<P>
|
|
In the example above, the remaining cylinders on the disk (numbered 508 to
|
|
683) are unused. You may wish to leave unused space on the disk, in case
|
|
you wish to create additional partitions later.
|
|
<P>
|
|
Finally, we use the <tt>w</tt> command to write the changes to disk and
|
|
exit <tt>fdisk</tt>.
|
|
<P><TT> Command (m for help): w
|
|
<P>
|
|
#
|
|
<P></TT>
|
|
<P>
|
|
Keep in mind that none of the changes you make while running <tt>fdisk</tt>
|
|
will take effect until you give the <tt>w</tt> command, so you can toy with
|
|
different configurations and save them when you're done. Also, if you
|
|
want to quit <tt>fdisk</tt> at any time without saving the changes, use the
|
|
<tt>q</tt> command. Remember that you shouldn't modify partitions for
|
|
operating systems other than Linux with the Linux <tt>fdisk</tt> program.
|
|
<P>
|
|
Remember that you may not be able to boot Linux from a partition
|
|
using cylinders numbered over 1023. Therefore, you should try to create
|
|
your Linux root partition within the sub-1024 cylinder range. Again,
|
|
if this is impossible, you can simply boot Linux from floppy.
|
|
<P>
|
|
Some Linux distributions require you to reboot the system after running
|
|
<tt>fdisk</tt>. This is to allow the changes to the partition table to
|
|
take effect before installing the software. Newer versions of <tt>fdisk</tt>
|
|
automatically update the partition information in the kernel, so rebooting
|
|
isn't necessary. To be on the safe side, after running <tt>fdisk</tt> you
|
|
should reboot the installation media, as before, before proceeding.
|
|
<P>
|
|
<A NAME=1329> </A>
|
|
<A NAME=1330> </A>
|
|
<P>
|
|
<BR> <HR><A NAME=tex2html2628 HREF="node74.html"><IMG ALIGN=BOTTOM ALT="next" SRC="next_motif.gif"></A> <A NAME=tex2html2626 HREF="node70.html"><IMG ALIGN=BOTTOM ALT="up" SRC="up_motif.gif"></A> <A NAME=tex2html2620 HREF="node72.html"><IMG ALIGN=BOTTOM ALT="previous" SRC="previous_motif.gif"></A> <A NAME=tex2html2630 HREF="node1.html"><IMG ALIGN=BOTTOM ALT="contents" SRC="contents_motif.gif"></A> <A NAME=tex2html2631 HREF="node250.html"><IMG ALIGN=BOTTOM ALT="index" SRC="index_motif.gif"></A> <BR>
|
|
<B> Next:</B> <A NAME=tex2html2629 HREF="node74.html">2.3.4 Creating the swap </A>
|
|
<B>Up:</B> <A NAME=tex2html2627 HREF="node70.html">2.3 Installing the Linux </A>
|
|
<B> Previous:</B> <A NAME=tex2html2621 HREF="node72.html">2.3.2 Drives and partitions </A>
|
|
<BR> <HR> <P>
|
|
<BR> <HR>
|
|
<P><ADDRESS>
|
|
<I>Matt Welsh <BR>
|
|
mdw@sunsite.unc.edu</I>
|
|
</ADDRESS>
|
|
</BODY>
|