How To Create A Partition On A Linux Server?

September 15, 2011 / Web Hosting

If you want to create a new partition on a Linux server then you have to follow the following steps :

Login to your Linux server with root access which is provided by your hosting provider.
Use the following command to find out the total number of partitions which are already created on your Linux server.

#fdisk -l

After using the command you get the following details :

Disk /dev/sda: 499.5 GB, 499558383616 bytes
255 heads, 63 sectors/track, 60734 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/sda1 * 1 653 5245191 83 Linux
/dev/sda2 654 3713 24579450 82 Linux swap / Solaris
/dev/sda3 3714 6324 20972857+ 83 Linux
/dev/sda4 6325 60734 437048325 5 Extended
/dev/sda5 6325 8935 20972826 83 Linux

If you need a 1000MB partition then you follow the below steps :

#fdisk /dev/sda

Type n for new partition and specify the cylinder size as +1000M then

Type p to find new partition

Type w for save

Then use the following command

#partprobe

After creating the partition you have to format that.

#mke2fs -j /dev/sdaX

The “X” indicate your created partition number.

Create that particular directory where you wish to point your new partition.

#mkdir -p /new

you have to point your new partition to that particular directory with the below command.

#mount -t ext3 /dev/sdaX /new

If you want to save these setting permanently then utilize the below command.

#vi /etc/fstab

/dev/sdaX /new ext3 defaults 0 0

Save and quite the fstab file.

Leave a Reply

Your email address will not be published. Required fields are marked *