Donate to us!
Capitalism is an Island of wealth in a sea of poverty
Tuesday, October 16, 2018
 Need Help?
Members Online
Total Online: 96
Guests Online: 94
Members Online: 2

Registered Members: 107158
Newest Member: secidea
Latest Articles

Fdisk: Partitioning Your Hard Drive

Arrow Image Detailed explanation on using Fdisk to partition your hard drive.

Here is a very detailed walk through on using fdisk, which is what I used to create my partitions for my Linux install. I used fdisk with my Slackware install so parts of this tutorial may be a little bit different for other Linux distributions, but it should all be very similar. When installing a new Linux distribution you should at the very minimum make two partitions one for root(/), and one for swap space (the disk space that is set aside for virtual memory, where processes go if out of physical memory).

When you start the distribution's install CD, after loading the kernel (bare.i in my Slackware 10.1 install), you can login as root without a password. After logging in, it tells you that at this time it is possible to partition your hard drive, or continue to the regular setup by typing setup. At this time you can type fdisk, or cfdisk, which is a very similar partition program, only difference being that cfdisk has a nice GUI to it but does lack some of the features of fdisk. I personally like fdisk better, it’s very easy and simple to use, but if you don’t like to work with a command prompt then use cfdisk, you should be able to figure it out.

In Linux, hard disks are not represented by letters like C or D drives, but are instead represented by a file. The primary master hard disk is /dev/hda, and if you have slave hard disk is /dev/hdb. Any additional hard disk on the master drive would be represented like /dev/hda1, /dev/hda2, etc. Therefore, you need to start fdisk and tell it which hard disk to partition such as # fdisk /dev/hdb

First thing you should do is type p after it asks you for a command to see current partitions.

Now what you're going to do is delete all the partitions on this drive by running the d command and then the partition number, to clear space for your Linux install. Before installing Linux, you first need to partition the hard drive that you want to install Linux on into two partitions so that you can later delete the second empty partition, and partition the empty space that this creates into you Linux partitions.

Next, you want to create the partitions for Linux. This is where it comes to personal preference on what partitions you want to make. You should, without a doubt, make partitions for root (/) and a swap space partition. I also choose to make partitions for /usr, and /home, so 4 partitions in total. To make partitions use the n command. It then asks you if you want to create an extended or a primary partition. Make sure to choose primary. Then choose 1 to create the first partition (2 for the next one, 3, and then 4, you get the picture). Then for the first cylinder type 0(which is default). For last cylinder, I did +64M. We are creating this first partition for swap space, and by choosing from 0 to 64, this gave us a 64 megabyte partition for swap. Swap doesn’t need to bigger than this usually. Then repeat this process for the next 3 partitions. Each time choosing primary partition, it is often smart to follow the default number for first and last cylinder. You can change this depending on the size of the hard drive or space you put aside for Linux. If you have a much larger hard drive then increase these numbers.

After making all the partitions, we need to change the partition types to Linux (83) for /, /usr, /home partitions, and Linux Swap (82) for the first partition, which you put aside for swap. Type t as the command, choose each partition in order, and make the swap 82, and the rest 83. Finally type p to see the current partitions and check that everything is correct. It should look something like this:

Disk /dev/hdb: 64 heads, 63 sectors, 621 cylinders
Units = cylinders of 4032 * 512 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 184 370912+ 83 Linux
/dev/hdb2 185 368 370944 83 Linux
/dev/hdb3 369 552 370944 83 Linux
/dev/hdb4 553 621 139104 82 Linux swap

You can now quit fdisk and be proud of yourself for having completed, for most people, the hardest part of the installation.

Right now, none of the partitions have been assigned to anything such as /, /usr, or /home or been activated as a swap partition. All of this is done later, after typing setup as root and going through the rest of the installation. So don’t worry that it says hdb1, hdb2, hdb3, hdb4.

If your intent is to dual boot Windows with Slackware, then read CChild's sticky about it in the OS specific section of the HTS forums, or Google it. It is very easy to dual boot with programs such as LILO (Linux loader) or GRUB (Grand Unified Bootloader). I use LILO, but I heard GRUB is very good as well. With LILO, a red screen comes up at start allowing you simply to choose which OS to load. It's as simple as that. The first time I installed Slackware, I chose not to setup LILO during the install, which proved to cause a problem. It would not allow me to start Slackware when restarting. The OS just simply didn't know where to look for the kernel and system files when starting Slackware without LILO to guide it. Always choose to setup LILO or GRUB, whichever you choose, during the install and not later as this is also an option. I just made it write to the master boot record and it worked fine. LILO configurations can always be edited later on in etc/lilo.conf if something isn’t correct. Just don’t forget to run /sbin/lilo in a konsole after making changes for them to take effect, I forgot to do this the first time I edited LILO :P.

Hope this helped you out. Post any questions you have about it here, or pm me. It may seem frightening at first, but fdisk is not a hard program to use. Thanks Mets0c30 for being a grammar nazi and looking this over for spelling mistakes.



thousandtooneon December 20 2005 - 20:32:58
Well, it's nice..but how about pointing out where it came from since it looks like you stole it.. If you didn't, then just point out what other accounts/sites you posted this with/on.
metsoc30on December 21 2005 - 03:00:57
thousandtoone, why don't you prove that it's copied before you go start accusing people? Why can't you accept that some people around here actually know what they are talking about. Perhaps you should read the last line of the article closely before you go out accusing people?
thousandtooneon December 21 2005 - 07:17:48
"If you didn't, then just point out what other accounts/sites you posted this with/on." I googled the article and it came up on another hacking site run very similar to HBH. All I wanted was for whomever this was posted by to mention what other accounts or sites they posted it on. If it was the same username, I wouldn't have even brought this up. The account also joined the same day as the post. I also DID look at the last line before I posted and thought it was interesting that had they stolen it, they had forgotten to change that as well. I was JUST asking for validation. NOTHING MORE. God, people around here are touchy!
Wsoprulz1299on December 21 2005 - 22:00:46
i also posted this on hts
Wsoprulz1299on December 21 2005 - 22:06:13
plus enigma
wolfmankurdon December 29 2005 - 17:50:31
Fuck thousandtoone you google passages from articles to check if they have been copied? LOL!!! You have way too much time on your hands...
pr1nc3on April 03 2006 - 18:06:51
very pointless article. almost all installer, nowadays, give you a visual map of the partiionning table for your system... any installer requiring text mode partionniong should be neglected, and any person who doesnt know how to partition their hard drive w/o a tutorial needs to join a different site (not HBH), since a true hacker would know that shit already.
system_meltdownon May 13 2006 - 17:10:04
Hm, where's the article gone O_o
Wsoprulz1299on May 14 2006 - 21:13:13
pr1nc3, you're an absolute dumbass system_meldown, im asking myself the same thing, where the fuck ismy article :?
Wsoprulz1299on July 15 2006 - 19:21:35
hmm k put article back in.. still don't know what happened to it though :S
Post Comment


You must have completed the challenge Basic 1 and have 100 points or more, to be able to post.