How do I create partitions in Linux?

If you have free, unpartitioned space on a harddrive, you may use the fdisk command.



NOTE:As this utility modifies the partition table on the harddrive, you
should exercise extreme caution when using this tool, as the risk of
data lose is high.




As an example, if your secondary harddrive is /dev/hdb, you may run the following command as root:



server ~ # fdisk /dev/hdb



The number of cylinders for this disk is set to 9726.

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):



To print the partition table of the selected drive, press ‘p’:



Command (m for help): p



Disk /dev/hda: 80.0 GB, 80000000000 bytes

255 heads, 63 sectors/track, 9726 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes



   Device Boot     
Start        
End      Blocks   Id  System

/dev/hdb1  
*          
1         
13      104391   83  Linux

/dev/hdb2             
14        
257     1959930   82  Linux swap /
Solaris

/dev/hdb3            
258        5121   
39070080   83  Linux

/dev/hdb4           
5122        9726   
36989662+  83  Linux



Command (m for help):



If you have unpartitioned space on the drive, hit the ‘n’ key and
follow the prompts. To get a listing of the available partition types,
hit the ‘l’ (ell) key. The main ones that we are concerned with are
type 82 and type 83. 82 is used for swap partitions under Linux, and 83
is used for any actual Linux partitions.



To exit this utility without saving any changes, hit the ‘q’ key.
However, if you have made changes and wish to save them, then hit the
‘w’ key.

Your rating: None Average: 2 (1 vote)