Managing disk partitions on Linux has never been easier. Here’s how to create, delete, and format partitions with fdisk.
But since disk partitioning is an essential step in OS installation and file organization, among other things, it’s imperative to know how to manage partitions on your computer.
Managing partitions is one of the most tedious operations on Linux. If you’re new to the operating system, you might even find the process confusing at the outset.
To this end, here’s a guide on how to use fdisk to create, resize, and delete partitions on Linux.
How to Install fdisk on Linux?
Fdisk is a standard partitioning utility, and therefore you’ll find it pre-installed on most Linux distros out there. To find out if your system has fdisk, open the terminal and run:
What Is fdisk?
Fdisk is a text-based command-line utility for viewing and managing hard disk partitions on Linux. It supports various partition tables and lets you create, delete, and modify disk partitions, so you can utilize the disk space effectively to install operating systems, back up your data, and organize your files.
If it returns a path, that means fdisk is present on your system. In case it doesn’t, you need to install it manually.
On Debian-based systems:
sudo apt install fdisk
On Fedora: sudo dnf install fdisk
On Arch-based distros:
sudo pacman -S fdisk
On CentOS: sudo yum install fdisk
How to Use fdisk on Linux
Once you’ve installed fdisk, follow the sections below to learn how to use it for performing different disk management operations on your system.
Listing All Disk Partitions
First and foremost, let’s list out the partitions on your system. We can do this using the -l argument with the command. In the terminal window, type the following command and press Enter:
sudo fdisk -l
Output: using fdisk to list disk partitions
Entering and Using Command Mode
After you’ve listed the available partitions on your system, you now need to enter command mode to be able to perform any operations on your disk. For this, choose the device on which you want to carry out operations and run the following command:
- How to use fdisk in Linux to manage disk partitions
- Check all news and articles from the latest Security news updates.