Latest Blogs

How to Create Primary or Logical Partition in Ubuntu using Fdisk Utility

In this article, we are going to discuss the basic and important operation while running the linux operating system. Create a partition is still confusing and risky task by the administrators. Choosing the right command and application is very important while you are managing any server in specific organization.

managing fdisk command line tool linux

In GUI interface, it is easy to build or make partition in the operating system. But when you interacting with the command line interface, you need to follow some commands. In this article, we will share you simple and easy steps to build or make partition in ubuntu operating system. In addition, the same commands are applicable in other linux flavors. 

Operating system manages three types of partition available. These are:

·         1. Primary Partition

·          2. Extended Partition

·         3. Logical Partition

These partitions types depend upon their allocation and availability in the hard disk. You can create one of these in the linux operating system. Note: In extended you can mention the range of partitions blocks size where you can create multiple logical partitions.

Fdisk is utility available in linux OS managing the all partitions table information. You can also create or remove partitions according to user requirement. You can call the command “fdisk” to know more information related fdisk command line tool.

How to Create a Partition?

Log in ubuntu OS and open “Open Terminal” or login command line interface if you are using other linux variants.

First of all need to check the all existing partitions in operating system. You need to apply the below command to view the partition table information:

# fdisk –l

Press enter to proceed. You will all the listed partitions available in linux operating systems. 

fdisk command


 Note: /dev/sda is hard disk drive path and /dev/sda1 is first partition and so on.

Now you can also see there is start and end term shown in the figure. It represents the HDD blocks allocation to specific partition. For instance /dev/sda1 is covering 1 to 1175 sectors in HDD.

fdisk option

Another step is to open the fdisk utility in command line tool is operating system. In figure, you can see multiple options to build a partition or manage the partition settings. If you want to create the new one you need to select “n” with mentioned description “add a new partitions”.

primary logical extended partitions

Select the “n” option to proceed the new partition process. After that you will get option to select either primary or logical partition in the hard disk. Select whatever is required, for example you can select “p” to create primary partition.

create  a partition

You will require mentioning the appropriate size according to your requirement.

save partition information

By accepting their default value of the hdd sector, it will create the new partition in your HDD. Select “w” for write changes the partition table information.  

new partition in linux

Now you can see that new partition is created in the HDD. Now you can select or mount it for personal use as well.

mke2fs command

But before doing that, you will required to format the partition created in the operating system. In that case you need to apply “mke2fs” command for format the HDD partition.

mount a partition

At final stage of using the partition, you need one folder to use the HDD partition space in the operating system. First you need to create folder and then mount it. Reference mounts command mentioned in figure. After successful implemented command it will show the space under this folder. You can store and use the partition easily.

/etc/fstab configuration file


If you want to mount it permanently HDD space you can configuration file /etc/fstab.

To open the configuration file open with vi editor

# vi /etc/fstab

Enter to proceed the command.


Final Words

Partitions are the backbone of the operating system. Without partitions we can’t install OS or run any application. As we discussed in this article, there are three types of partitions primary, logical and extended. These are their own working and usable capability. But when you interacts building a partition in command line interface. It is obviously difficult task and risky for the admin or system administers. Mentioned resolution is provided that would be beneficial for you to create primary or logical partitions. There are few commands need to remember but when you expertise these commands then you are gem. Article last steps performed related to mount or use permanently newly created partition in the operating system. You are required to mention the hdd information to use it. Fdisk is great command line tool for managing a disk drive partitions. You can remove or add partition even you can change the partition type (In the case of RAID implementation, we will surely discuss this topic later). If you need more information related to this article you can send us query.  Read more educate more.



 


 


 


 





No comments