Article overview

Help article

How do I add a partition in CentOS?

Before you can utilize new disk space, the space needs to be allocated to a new partition. In this FAQ you find a six step explanation to guide you through the process of creating a partition on your BladeVPS. Note: unless mentioned, a command is always followed by an enter.

  • First make sure that you are logged in as root, if your are not then use the command "su -". To create a partition, login as root on your VPS. Use the following command to initiate the creation of a partition “fdisk /dev/vda”. Give the command “p”. You will now see your current partitions. Partitions 1, 2, 3 and 4 are your primary partitions. Pick a number from the primary partitions that is not shown in the table (usually this will be 3 or 4). Write the number down or memorize it as you will need it for the following steps. Press “n” to continue with the process.
  • Now press “p”. You must specify the partition number. Choose a number that is not yet taken. You know which partitions these are from the previous step. Please document or memorize the partition number, you will need this later on. If you are asked to submit a first cylinder choose the default by pressing enter. The same applies for the last cylinder. Now write the partition by giving the command “w”
  • “Reboot” your VPS and run the following command “mke2fs -j /dev/vdaX”. Replace the X with the partition number from the previous steps.
  • After the partition is formatted you will need to create a new so-called 'mount point'. Create a new directory with the following command “mkdir /mynewpartition” you can use any name you want for “mynewpartition”. Please memorize or write down the partition name. You will need it in the coming steps.
  • Now copy “/etc/fstab” by using the command “cp /etc/fstab /etc/fstab.bak”. The partition is now ready to be added to /etc/fstab. Use the following command “echo '/dev/vdaX /mynewpartition ext3 defaults 1 1' >> /etc/fstab”.
    Replace the X with the partition number from the previous steps.
  • Now use this command to mount the partition and your Harddisk Upgrade is completed: ”mount /mynewpartition”

Do you have a good idea?

Give us your idea! If it's popular we'll add it to the wishlist!

Has this article been helpful?

Create an account or log in to leave a rating.

Share this article

Comments

Create an account or log in to be able to leave a comment.

Are you stuck?

Ask one of our specialists to assist you

Contact us