GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Add
  • Follow
  • Windows
  • Linux
  • Android
  • Apple
  • Tech Explained
  • Networking
  • Security
  • Productivity
  • Creative
  • Entertainment
  • Streaming
  • Smart Home

This view

  • Original page
  • New address

GeezerVison is showing www.makeuseof.com — How to Create, Resize and Delete Linux Partitions With Cfdisk

Add MakeUseOf on Google Add as Preferred Source Follow on Google Discover
4
By  Deepesh Sharma
Published Feb 22, 2021, 10:30 AM EST
Deepesh started writing about technology when he founded his consumer tech blog in 2018. He joined MakeUseOf in 2021 and wrote primarily for Linux, Programming, Windows, and Gaming. He has a bachelor's degree in Computer Applications, during which he tried his best to "enjoy" his assignments.

When not penning down informational guides on Linux or Programming, you can find him secluded in a corner reading books, playing some self-proclaimed "cool" riffs on his acoustic guitar, or searching for new hobbies to take up, only to quit and find a new one again. He's now the Linux and Programming editor at How-To Geek. 
Sign in to your MakeUseOf account
follow
Follow
followed
Followed
Here is a fact-based summary of the story contents:
Try something different:

Partitioning your disks is one of the most frustrating tasks that you will come across while installing Linux. Sophisticated command line tools make it tricky for beginners to get started with partition management.

Add MakeUseOf on Google Add as Preferred Source Follow on Google Discover

What you need is a partitioning management tool specially developed for beginners. Here's when Cfdisk comes to the rescue. For those who want to manage partitions on their computer in a better way, Cfdisk is the best choice.

Here's how to create new partitions in Linux with Cfdisk, along with resizing, changing, and deleting partitions.

What Is Cfdisk

Cfdisk is a command line, text-based graphical tool that allows you to create, delete, and modify disk partitions on your system. Unlike other command line tools, Cfdisk provides an interactive way of managing partitions for beginners.

The Cfdisk package comes preinstalled on most of the well known Linux distributions. You can install Cfdisk manually if you do not find it on your system by default.

To install the package on Debian-based systems:

sudo apt-get install cfdisk

On Fedora:

sudo dnf install cfdisk

On CentOS:

sudo yum install cfdisk

On Arch-based distributions:

sudo pacman -S cfdisk

To launch Cfdisk in your terminal, type sudo cfdisk, and press Enter. The default user interface of the utility looks something like this.

cfdisk partition manager

Cfdisk also displays information associated with the storage device at the top of the screen. The following details are provided:

  1. Name of the disk
  2. Disk label
  3. Size in bytes and GB
  4. Number of sectors
  5. Identifier

If you have multiple storage devices on your system, you can specify which device you want to modify using the following syntax:

cfdisk [device]

If /dev/sda is your system's hard disk drive (HDD), then typing in cfdisk /dev/sda will allow you to manage partitions on your HDD only. Similarly, you can type in cfdisk /dev/sdb to partition external storage devices connected to your system.

Creating Linux Partitions With Cfdisk

To create new disk partitions with Cfdisk, you need to have free space on your storage. In the image below, note that we have 3GB of free space available to use.

partition table

For the demonstration, we will create a new partition by using the New option from the menu. You can traverse through the menus using the Right and Left arrow keys. To choose a partition from the table, use the Up and Down cursor keys.

create new partition cfdisk

To create a partition:

  1. Select the Free Space partition from the list
  2. Highlight the New option
  3. Tap Enter to confirm the action
  4. On a new unpartitioned disk, select Primary when prompted for the partition type
  5. Tap Enter to confirm

Now you will have to specify the size of the new partition. Since we have 3GB of space left in the storage, we will create a partition that's 3GB in size. You can enter any number you want (1GB, 2GB, etc).

partition size

Finally, select Write from the menu and hit Enter. Type in yes to confirm your choice.

Related: The Pros and Cons of Partitioning a Hard Drive

Changing the Linux Filesystem Type

When you create a new partition on your storage, the default partition type would be set to Linux Filesystem. However, if you are going to use the partition for something else, such as Linux swap or EFI, you can change the type with Cfdisk easily.

To change the filesystem type, select the newly created partition from the table. Choose the Type option from the menu and press Enter.

change partition type

Cfdisk provides you with 108 different partition types to choose from. You can choose the filesystem type that suits your needs.

Again, after changing the partition type, you need to write the changes to the disk. Select Write from the menu and press Enter. Type yes to finalize the process.

writing data to table cfdisk

Deleting Linux Partitions

Deleting partitions is the easiest job that you can do with Cfdisk. Simply choose the partition from the table, select Delete from the menu, and hit Enter.

delete old partitions

Now you need to write the changes to the disk by selecting Write from the menu.

Resizing Old Partitions on Linux

Cfdisk allows you to change the size of your partitions within seconds.

First, select the partition that you want to resize and choose the Resize option from the menu. Next, specify the new size that you want to allocate to the partition. For this demonstration, we will resize the newly created partition to 2GB.

resizing disk partitions cfdisk

Once again, you will have to Write the changes to the disk.

resizing partitions in linux

Additional Cfdisk Commands

Although Cfdisk is the perfect choice for beginners who do not want to play around with text commands, you can still manage your partitions using the command line with Cfdisk.

For those who have decent experience working with other terminal-based partition management tools like Fdisk, here are some additional commands that you can use with Cfdisk.

  • -h, –help: Display help related to Cfdisk usage.
  • -L, –color: Colorize the output displayed on the screen.
  • -V, –version: Display version details about Cfdisk.
  • -z, --zero: This allows you to create a new partition table from scratch. The previous partition table is not read by the application.
  • b: Toggle the bootable flag on or off for the selected partition.
  • d: Delete the highlighted partition.
  • h: Display the help screen while using Cfdisk.
  • n: Create a new partition from the selected free space.
  • q: Quit the program without writing data to the table.
  • s: Fix the partition order.
  • t: Change the type of the selected partition.
  • u: Dump the disk layout to an output file.
  • W: Write the data to the table.
  • x: Toggle the display of additional information related to the selected partition.

Partition Management With Cfdisk

Knowing how to create and manage your disk partitions is important if you are running Linux on your computer. Even during Linux installation, users have to partition their storage in order to allocate memory to the system. Dual-booting a Linux distribution with no knowledge of drive partitioning comes with a huge risk factor.

Although many Linux distributions allow you to partition your hard drive graphically, some of them don't. To easily counter such situations, getting comfortable with at least one command line partition management tool is a must for anyone.

  • Linux
  • Disk Partition
  • Linux
Follow
Followed
Share
Facebook X WhatsApp Threads Bluesky LinkedIn Reddit Flipboard Copy link Email
Add MakeUseOf logo on Google
Preferred Source Google Discover
Readers like you help support MakeUseOf. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.
  • Technology Explained

  • PC & Mobile

Two full-size desktop RAM sticks and a shorter laptop SO-DIMM fanned out in front of blue and green PC fans
DDR6 RAM just got its first real specs, and it makes DDR5 look slow
Unix's System V
Your Mac, your PlayStation, and your router are running the operating system that lost
A phone displaying Copyparty's file uploader beside a laptop showing shared files.
I turned an old Windows laptop into a home file server that beats any USB drive
See More
A Google Pixel 11 Pro and Samsung Galaxy S26 Ultra propped against a wall with the Pixel Buds 2a in front of them.
Google and Samsung have a way to find the one earbud that always goes missing
windows 11 desktop featured
Windows 11 26H2 is rolling out automatically, and it puts your old PC back on support
The ChatGPT app for Android on a vinyl-themed rug.
OpenAI's first phone may be built by Foxconn, the company behind iPhones
See More
whirlpool dryer door closed
Please stop cleaning only your dryer’s lint trap. The vent is where the fires start
Using Mullvad VPN on Windows
I self-host almost everything, but these subscriptions are still worth paying for
dewalt-9-gal-shopvac-lifestyle
DeWalt's 9-Gallon Shop Vac is now half off ahead of Black Friday
You are visitor 01402639 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.