Using fdisk (cont'd)
Creating an ext2 partition
These days, Linux is using the ext2 filesystem as its
default, so that's what we're going to learn how to make
next. I'm going to go over this very quickly because
it's pretty much exactly the same as the swap partition
creation, minus that system ID switch.
In this example, I'm going to create a 1GB partition.
Again, first step is "n".
Command (m for help): n
Command action
l logical (5 or over)
p primary partition (1-4)
Then, for reasons explained earlier, I have to choose
"l" for logical.
l
First cylinder (1384-2491, default 1384):
Use the default (hit Enter).
Using default value 1384
Last cylinder or +size or +sizeM or +sizeK (1384-2491,
default 2491):
We want a gigabyte, so we want 1024MB, so we enter in
"+1024M":
Last cylinder or +size or +sizeM or +sizeK (1384-2491,
default 2491): +1024M
Command (m for help):
List the partitions to see if we got it right, I get
this for the last line:
/dev/hdb14 1384 1514 1052226 83 Linux
Once again, all we have to do now is write the table
to disk, and then create a filesystem on that partition
and we are ready to go. So, we hit "w" and we are done
with creating partitions.
Deleting Partitions
This is so incredibly easy, I'm not even going to DO an
example. It's option "d" in fdisk. When you hit that,
it will ask for a partition number. Simply give it that
number and the partition is deleted! However, as a
technicality (and as a way to insure against people
accidentally deleting partitions), this change doesn't
take effect unless you write the partition table to disk
again. So, once your partition is deleted, simply hit
"w" and then it's gone for good.
IMPORTANT NOTE - You can never have gaps in the
partition numbering scheme once you get past 5. If you
delete a logical partition that isn't the last one, it
WILL mess up all the partitions that came after it
because it will shift them all down. In my example,
if I were to delete partition 13, partition 14 would
then become partition 13. This is very dangerous on a
running system! If you delete partitions that come
before partitions that are normally mounted on startup
you MUST edit /etc/fstab to fix the changes.
That's it for fdisk! You can now create the two
necessary types of partitions to build a Linux system
the way you want it.
Send me feedback - Danny "Strike"
DiPaolo
Would you like to have your article published online? Send them in to newfiles@linuxnewbie.org
|