NOTE: if you read the tutorial and are still experiencing difficulties and would like help, you are asked to start a new topic on the forums.
Please do NOT reply to this thread to ask a technical question. Replies to THIS thread should be corrections and enhancements on the tutorial/howto only.
Thanks in advance for your co-operation.
LinuxForums.org

------------------------------------------


For this small tutorial we assume the following.
You have a system with one harddisk in it and as primary OS: Linux.
As this is a 10GB drive and you are running low on diskspace you buy a new, bigger and better one. Instead of replaceing the old one, you want to create several partitions on your new harddrive and mount them on boot time.
(Your CD/DVD is installed as primay on your second IDE controlere and therefore known as : /dev/hdc)

Your primary harddisk is known to linux as /dev/hda
You install you new HD in you machine and connet the cables.
Since it will be a slave to the primary disk it will be known as /dev/hdb

You'll notice that during bootup linux will see the new harddisk and show some information about it:
Here is an example from dmesg:
Code:
hda: ST38410A, ATA DISK drive
blk: queue c0402f40, I/O limit 4095Mb (mask 0xffffffff)
hdb: ST38410A, ATA DISK drive
blk: queue c0402f40, I/O limit 4095Mb (mask 0xffffffff)
hdc: SAMSUNG DVD-ROM SD-616F, ATAPI CD/DVD-ROM drive
hdd: R/RW 4x4x32, ATAPI CD/DVD-ROM drive
ide0 at 0x1f0-0x1f7,0x3f6 on irq 14
ide1 at 0x170-0x177,0x376 on irq 15
hda: attached ide-disk driver.
hda: host protected area => 1
hda: 16841664 sectors (8623 MB) w/512KiB Cache, CHS=1048/255/63, UDMA(33)
Partition check:
 hda: hda1 hda2
hdb: attached ide-disk driver.
hdb: host protected area => 1
hdb: 16841664 sectors (8623 MB) w/512KiB Cache, CHS=1048/255/63, UDMA(33)
Partition check:
<none>
ide&#58; late registration of driver.
If you start in graphical mode, login and open a terminal session and su to the user: root.
When booting into text mode, log as root.

Type: fdisk /dev/hdb

[root@garfield root]# fdisk /dev/hdb

The number of cylinders for this disk is set to 1048.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):
You'll see something like the above quote.
Our HD is for this example 30GB and we want to create 3 partitions of 10GB each.
Press n to create a new partition,
select if you want to create a primary or extended partition.
For this example we'll now create a primay partition.
Press P to create a primay partition
select the partition number 1 - 4
Select the starting cylinders, usualy : 1
type +10000M to select the ending of the first partition at 10GB.

example:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1868, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-1868, default 186: +10000M
You can display partition table information by pressing p


Command (m for help): p

Disk /dev/hdb: 15.3 GB, 15367790592 bytes
255 heads, 63 sectors/track, 1868 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 1 1217 9775521 83 Linux

Command (m for help):
As you can see, one partition of 10GB future moutable as /dev/hdb1

To create the second press n again, select primary.
Default the starting cylinder is the previous ending +1,
If the previous partition ended at block 1217 the new one will start at 1218.
For the last cylinder of type: +10000M again.
This will create the second 10GB partition.
Type p to verifiy and view the partition table.
Now do the same for partition 3.

Now we're done, but still need to write the new partition table to disk,
this is done by pressing: w
You'll return to the root prompt when the new partition table information is written to disk.
Reboot the system and login again as user root or as yourself and su - to user root.

Now it's time to format the partitions and select a future mounting position.
We can choose from various filesystems.
EXT2 is the old one, but we want the journaling version; EXT3
To format the partitions type: mkfs.ext3 /dev/hdb1
For the other partitions this would be :
mkfs.ext3 /dev/hdb2
mkfs.ext3 /dev/hdb3

Now it's time to modify the fstab to mount these partitions in the future at boot time.
Let's say that partition1 (/dev/hdb1) will be used to store webpages and you want to mount it under the htdocs directory of apache.
I've installed apache in /opt/apache
but a default installation of Fedora Core will place the www root dir in /var/www
To locate where you web root directory is type : locate htdocs
For this example we'll assume it's locate in /var/www/htdocs
Edit the fstab in the etc directory:
I prefer VI but use any editor you want.
Note:You'll need to be logged in as superuser to modify the fstab.
Insert at the bottom line the following:
Code:
/dev/hdb1       /var/www/htdocs        ext3    defaults        1  1
Save and quit.
Next time you boot partition 1 of the new harddisk will be mounted at /var/www/htdocs
check before rebooting that the dir /var/www/htdocs is empty if not make a copy in your /root/ dir so that the next time you boot up you can place all the file that were there are restored.
(There are different way to do the same, but this is the quickest one for the less experienced ones.)
Now we want partition 2 to mount at /opt
(it's default an empty or non-exising dir.)
And entry in the fstab would look like:
Code:
/dev/hdb2       /opt        ext3    defaults        1  1
Let's say you want the /home dir to be the mount point of partition 3 ...
But there are 4 users with data in. Mounting it now there will make all that information 'disappear'. We can't have that...
Mount partition 3 behind folder /mnt , so we can copy all information there.
type:mount -t ext3 /dev/hdb3 /mnt
now start up Midnight commander and copy the contents of /home to the just mounted disk at /mnt
Or cd /home and type: cp -R * /mnt
Wait until everything is done.
Now we can modify the fstab.
And a line like the following:
Code:
/dev/hdb3       /home        ext3    defaults        1  1
Since you copied the information the next time you boot the system everything is still there.

Okies, this should give you a short insight into how to create partitions, format them and mount them at boot time.
For further information type: man fstab and use google