How To Create a New Disk on Linux

In this article, we want to teach you How To Create a New Disk on Linux. You can manage data by using the disk partition. Disk partition is a logical division of an HDD or SSD.

This tutorial shows you to create a new disk partition on your Linux server.

How To Create a New Disk on Linux?

In this guide, we will use the fdisk command to create a new disk on Linux servers. To complete this guide, log in to your server as a root user or non-root user with sudo privileges and follow the steps below.

Add a new Disk Partition on Linux

As we said, we want to use the fdisk command to create a new disk. You can use fdisk to create and manipulate disk partition tables.

List Current Partitions and Configuration with fdisk

First, you can display your current partitions by using the following fdisk command on Linux:

fdisk -l

For example, you have /dev/sda disk, and /dev/sda1 and /dev/sda2 as partitions.

Add a new disk partition

At this point, you can use the following fdisk command on your Linux server to create a new partition in /dev/sda disk:

fdisk /dev/sda

With this command, you will open the fdisk prompt. Type n and press enter to create a new partition.

Then, you have to select between creating a primary or extended partition. Here we choose the recommended one as the primary partition. So choose p and press enter.

Next, you have to enter the partition number and the size of the partition in sectors.

After that, you need to write the changes to the disk by typing w and pressing Enter. 

Finally, you can verify your added disk by using the command below:

fdisk /dev/sda

fdisk commands and options

Here are some commonly used fdisk commands listed below:

  • n – Create a partition
  • p – print the partition table
  • d – delete a partition
  • q – exit without saving the changes
  • w – write the changes and exit.

Conclusion

At this point, you have learned to Create a New Disk on Linux with the fdisk command. You can use fdisk to create and manipulate disk partition tables.

Hope you enjoy it. You may like these articles too:

Find Hard Disk Information on Linux

How To Disable Remote Access in MySQL Database

How To Manually Install Driver Module in Linux

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Stay informed and not overwhelmed, subscribe now!