How to Visually Partition Disks Using the cfdisk Command in Linux

When you are standing up a new Linux server and need to rapidly carve a raw physical hard drive into multiple logical partitions, using raw command-line tools like fdisk or parted can be mathematically overwhelming for administrators who prefer visual interfaces. However, you cannot run a GUI tool like GParted on a headless server without a desktop environment. To inject a highly intuitive, visually structured, curses-based interface directly into the raw terminal, you must use the cfdisk command.

Summoning the Visual Architecture

The cfdisk (Curses fdisk) command is a powerful partition table manipulator. It leverages the ncurses library to render a dynamic, keyboard-driven graphical interface entirely out of ASCII text within your SSH terminal session. It prevents catastrophic mathematical errors by visually representing the exact geometric layout of the drive’s sectors.

CRITICAL INFRASTRUCTURE WARNING: Modifying partition tables is inherently destructive. While cfdisk provides a safe visual sandbox to plan your edits, the moment you commit the changes to the disk, the underlying data geometry is permanently altered. You must deploy root privileges to execute this command.

Executing the Curses Interface

To launch the visual engine against a specific physical drive (e.g., your secondary data drive, /dev/sdb), open your terminal and type:

sudo cfdisk /dev/sdb

The terminal will instantly transform. A massive visual matrix will deploy, showing the total size of the disk, the exact boundaries of any existing partitions, and any unallocated free space.

Navigating the Control Matrix

The interface is strictly keyboard-driven; your mouse is useless here.

  • Navigation: Use the Up and Down Arrow keys to mathematically select a specific partition or block of free space in the main matrix.
  • Action Execution: Use the Left and Right Arrow keys to cycle through the command menu at the absolute bottom of the screen (e.g., [New], [Delete], [Type], [Write], [Quit]).
  • Creating a Partition: Select the unallocated space, highlight [New], and press Enter. The engine will prompt you for the exact size (e.g., type 50G and press Enter). It will then visually slice the block on your screen.

CRITICAL COMMIT PROTOCOL: The changes you make in the cfdisk interface are completely virtual. To forcefully inject the new geometric architecture into the physical hardware, you must highlight the [Write] command at the bottom of the screen and press Enter. The engine will demand you type the word “yes” to confirm the destructive rewrite.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.