• Techiax

Need to know Linux Disk commands

Linux is the best open-source operating systems in the world. And most people love it cause of its various features and access to more features than windows or mac. Disk Management is one of the important activities you should know for Linux. GUI-based disk management is also available for many Linux distros. But giving command via command line gives you more features and makes you feel great.

Also Read: Best operating systems for hackers


fdisk is the basic command for mostly all the disk operations you will need to do in your Linux. It stands for "format disk" or "fixed disk". Type it in your Terminal and it will give you instructions on how to use it.

List all drives:

fdisk -l
It will show you the list of disks attached to your system like memory cards, pendrive, hard disks and more with names and number

Selecting a disk:

fdisk /dev/sda

When you list the drives itself, it will show you the names and locations of all the disks. Now you could just append it with fdisk to select the disk.

After selecting press 'm' for help. This will give you all the available functions for the drive and how to use it.

Creating a new partition:

Select your disk where you want to create a partition.

fdisk /dev/sda

Press 'n' to create a new partition.
Then press 'e' for extended partition and 'p' primary partition.

Then you would be asked to enter the number of cycles and size of the partition you want to make.

After entering all the details press 'w' to update the partition table.

Also Read: Why hackers prefer linux?

Delete a partition:

Select the disk where you want to delete the partition.

fdisk /dev/sda

Press 'd' to delete. It will ask for which partition to delete. Press the number based on your partition.
After that press 'w' to update the partition table.

Troubleshoot the partition:

Select the partition to troubleshoot.

fdisk /dev/sda

Then press 'x' to start the troubleshooting process. Then after the process is completed press 'f' to fix the partition

Format your Harddisk:

mkfs.ext4 /dev/sda4

This would format your hard disk.

Note: All the partition locations might not be same for your system. So try to check your partition locations on your system.

To print your partition table press 'p' after selecting your disk.

If you have any queries, please let us know in commands below.

Also Read: Make bootable Pendrive for Windows or Linux OS

Please share your views and thoughts that would make us do more.


I am an enthusiastic person striving to gather as much information as possible to achieve higher heights and to share the information to all others to make them also reach the stars.
"People who are crazy enough to think they can change the world are the ones who do"
-Steve Jobs.

Previous Post
Next Post