How to Create a filesystem in Linux using Fdisk

Fdisk is a tool to create partition on Linux. Linux partitioning using fdisk is easy to create.  using Fdisk We can view, create, modify and delete partitions from command line. In this Article  I will show you  how to manage Linux partitioning using  fdisk, we will  create new partitions and mount it to /etc/fstab.

To list the existing HD and partitions on your system we can  use fdisk -l command. using this command you can find all disk information attached to the system .



From above command chose from which disk you want to create new partition, here /dev/sdb where i want to make new partition. to create run command #fdisk /dev/sdb


Next Command mode

In command mode, you can use single letter commands to do actions you wish. Type m and press Enter to see a list of all the commands you can use.


Creating a  New Partition

You can use the n command to create a new partition. and chose to create either  extended or primary partition (e for extended and p for primary). In a hard disk only four primary partitions can be created.


Define the Size

select the partition number if it is first then select 1 or chose from fdisk -l command.



Print the Changes 

use p command to print all changes you made.


Writing Changes on disk

You can use w to write the changes you have made in the disk.

Use q command  if you want to quit without saving changes.



Reboot /Partprobe to apply the changes


Format  the  Partition

You have to  format new partitions with a file system before  use them. this can be done using mkfs command. in below command i have shown how to format using ext4 file system. select your partition which you have created, you can make swap partition as well using same process, only you need to change the file system to swap

#mkfs.ext4 /dev/sdb1


Mount the Partition 

once you assign the file system you need to mount the partition to use this, to Mount first create a directory where you want to mount and edit the file /etc/fstab and add the below line.





How to Create a filesystem in Linux using Fdisk How to Create a filesystem in Linux using Fdisk Reviewed by TecGeeks News on June 30, 2016 Rating: 5

No comments:

Get Your Business Online Now


Powered by Blogger.