SEARCH :

Custom Search

Thursday, April 26, 2007

Make a Partition with Fdisk

Do you confused how to make partition in linux? Actually we can use software like qparted to make a partition, but we can also make a partition with command line utility like fdisk. Use fdisk to make a partition is not difficult. May be first time you will confused, but after you can use it, fdisk will be a very fast tool to make partition on your linux.
First,you can look your harddisk partition with

[root@fecore ~]# fdisk -l

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1275 10241406 83 Linux
/dev/hda2 1276 1402 1020127+ 82 Linux swap / Solaris
/dev/hda3 1403 2677 10241437+ 83 Linux
/dev/hda4 2678 4865 17575110 5 Extended
/dev/hda5 2678 3569 7164958+ 83 Linux

After that you can start make your partition,example

[root@fecore ~]# fdisk /dev/hda

The number of cylinders for this disk is set to 4865.
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):

the command are
p
print the partition table

l
list the partition type

n
create a new partition

d
delete a partition

q
quit without saving changes

w
write the new partition table and exit

to see your partition now, type 'p' and press enter..

Command (m for help): p

Disk /dev/hda: 40.0 GB, 40020664320 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 1275 10241406 83 Linux
/dev/hda2 1276 1402 1020127+ 82 Linux swap / Solaris
/dev/hda3 1403 2677 10241437+ 83 Linux
/dev/hda4 2678 4865 17575110 5 Extended
/dev/hda5 2678 3569 7164958+ 83 Linux

make your new partition,press 'n'..

Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-22800, default 1):
Using default value 1
Last cylinder or +size or +sizeM or +sizeK (1-22800, default 22800): 13032
The last partition is the extended partition:

change your partition filesystem type,press 't'..
Command (m for help): t
Partition number (1-6): 6
Hex code (type L to list codes):

You can press 'l' to see the list of filesystem type..
after you choose one filesystem,press 'w' to write partition into your harddisk.

finished? not yet...
you must ust mkfs utility to write the file system... example:
you want to make a ext3 filesystem on your partition /dev/hda1..
# mkfs.ext3 /dev/hda1

note: correct me if i'm wrong =)
THE END

No comments: