Disk Partitioning

December 9th, 2006 liewsheng Posted in fdisk, Hardware, mkfs.ext3 | Hits: 33032 | 2 Comments »

Nowadays P2P like bittorrent are so popular, until others need to add a new harddisk to download all the stuff. A new harddisk is need to repartition before you can use it. To partitioning the new harddisk, you can use this:

sudo fdisk /dev/hd< x >

the < x > can be any of a, b, c … depend on which disk you want to partitioning. After the command is enter, a prompt will wait for you to enter the option :

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

Command (m for help):

If you don’t know the command, just press ‘m’ to list all the command can be use in the shell. If you want to print all the known partitions on the disk, just use press ‘p’:

Command (m for help): p

Disk /dev/hdb: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

­­­   Device Boot      Start         End      Blocks   Id  System
/dev/hdb1               1       12159    97667136   83  Linux
/dev/hdb2           12160       15199    24418800   83  Linux
/dev/hdb3           15200       20321    41142465   83  Linux

If this show a correct disk you want to partitioning and have free space, you can start to create a new partiton:

Command (m for help): n

this will only shown if you have empty partiton and the primary partition not finish using:

Command action
e   extended
p   primary partition (1-4)

so just choose which type of partiton you want. Next this will show:

First cylinder (3507-4997, default 3507):
Using default value 3507
Last cylinder or +size or +sizeM or +sizeK (3507-3722, default 3722):

Just enter for the ‘First cylinder’ option, then fdisk will wait for you to enter the size of the partiton. You can either enter the cylinder size or size in bytes, kilobytes or Megabytes (you need to add ‘+’). By default, fdisk will create a partition Linux type with ID 83. if you want to change the ID, just press ‘t’:

Command (m for help): t
Partition number (1-4): 4
Hex code (type L to list codes): 

If don’t know which ID you need to enter, try visit this table or just press ‘l’ to list all the ID/types. ’4′ is mean the 4th partition is choose (in this case the new partition has created). After all have done, need to save the partition info and exit the program

Command (m for help): x

what if you only find out you have do something wrong? Don’t worry instead of enter ‘x’, you have to press ‘q’ to quit the programm but not save it.

Command (m for help): q

The partition still can’t be use, you need to format the partiotn:

sudo mkfs.ext3 /dev/hdb4

In this example 4th partition is formatted using ext3 file system. If ext2 to be use, mkfs.ext2 is the right command. Finally this partition is ready to use ;p For more information, you can visit this link.

2 Responses to “Disk Partitioning”

  1. [...] The first thing I do is to check the hardisk with df, or fdisk [...]

  2. ???????| |???? ?????????

Leave a Reply