\fBcfdisk\fP is a curses\-based program for partitioning any block device. The default device is \fI/dev/sda\fP.
.sp
Note that \fBcfdisk\fP provides basic partitioning functionality with a user\-friendly interface. If you need advanced features, use \fBfdisk\fP(8) instead.
.sp
All disk label changes will remain in memory only, and the disk will be unmodified until you decide to write your changes. Be careful before using the write command.
.sp
Since version 2.25 \fBcfdisk\fP supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder\-Head\-Sector) addressing. CHS has never been important for Linux, and this addressing concept does not make any sense for new devices.
.sp
Since version 2.25 \fBcfdisk\fP also does not provide a \(aqprint\(aq command any more. This functionality is provided by the utilities \fBpartx\fP(8) and \fBlsblk\fP(8) in a very comfortable and rich way.
.sp
If you want to remove an old partition table from a device, use \fBwipefs\fP(8).
Colorize the output. The optional argument \fIwhen\fP can be \fBauto\fP, \fBnever\fP or \fBalways\fP. If the \fIwhen\fP argument is omitted, it defaults to \fBauto\fP. The colors can be disabled, for the current built\-in default see \fB\-\-help\fP output. See also the \fBCOLORS\fP section.
.RE
.sp
\fB\-\-lock\fP[=\fImode\fP]
.RS4
Use exclusive BSD lock for device or file it operates. The optional argument \fImode\fP can be \fByes\fP, \fBno\fP (or 1 and 0) or \fBnonblock\fP. If the \fImode\fP argument is omitted, it defaults to \fByes\fP. This option overwrites environment variable \fB$LOCK_BLOCK_DEVICE\fP. The default is not to use any lock at all, but it\(cqs recommended to avoid collisions with \fBsystemd\-udevd\fP(8) or other tools.
.RE
.sp
\fB\-r\fP, \fB\-\-read\-only\fP
.RS4
Forced open in read\-only mode.
.RE
.sp
\fB\-z\fP, \fB\-\-zero\fP
.RS4
Start with an in\-memory zeroed partition table. This option does not zero the partition table on the disk; rather, it simply starts the program without reading the existing partition table. This option allows you to create a new partition table from scratch or from an \fBsfdisk\fP(8)\-compatible script.
.RE
.SH"COMMANDS"
.sp
The commands for \fBcfdisk\fP can be entered by pressing the corresponding key (pressing \fIEnter\fP after the command is not necessary). Here is a list of the available commands:
.sp
\fBb\fP
.RS4
Toggle the bootable flag of the current partition. This allows you to select which primary partition is bootable on the drive. This command may not be available for all partition label types.
.RE
.sp
\fBd\fP
.RS4
Delete the current partition. This will convert the current partition into free space and merge it with any free space immediately surrounding the current partition. A partition already marked as free space or marked as unusable cannot be deleted.
Create a new partition from free space. \fBcfdisk\fP then prompts you for the size of the partition you want to create. The default size is equal to the entire available free space at the current position.
.sp
The size may be followed by a multiplicative suffix: KiB (=1024), MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB (the "iB" is optional, e.g., "K" has the same meaning as "KiB").
.RE
.sp
\fBq\fP
.RS4
Quit the program. This will exit the program without writing any data to the disk.
.RE
.sp
\fBr\fP
.RS4
Reduce or enlarge the current partition. \fBcfdisk\fP then prompts you for the new size of the partition. The default size is the current size. A partition marked as free space or marked as unusable cannot be resized.
.sp
\fBNote that reducing the size of a partition might destroy data on that partition.\fP
.RE
.sp
\fBs\fP
.RS4
Sort the partitions in ascending start\-sector order. When deleting and adding partitions, it is likely that the numbering of the partitions will no longer match their order on the disk. This command restores that match.
.RE
.sp
\fBt\fP
.RS4
Change the partition type. By default, new partitions are created as \fILinux\fP partitions.
.RE
.sp
\fBu\fP
.RS4
Dump the current in\-memory partition table to an \fBsfdisk\fP(8)\-compatible script file.
.sp
The script files are compatible between \fBcfdisk\fP, \fBfdisk\fP(8) \fBsfdisk\fP(8) and other libfdisk applications. For more details see \fBsfdisk\fP(8).
.sp
It is also possible to load an sfdisk\-script into \fBcfdisk\fP if there is no partition table on the device or when you start \fBcfdisk\fP with the \fB\-\-zero\fP command\-line option.
.RE
.sp
\fBW\fP
.RS4
Write the partition table to disk (you must enter an uppercase W). Since this might destroy data on the disk, you must either confirm or deny the write by entering `yes\(aq or `no\(aq. If you enter `yes\(aq, \fBcfdisk\fP will write the partition table to disk and then tell the kernel to re\-read the partition table from the disk.
.sp
The re\-reading of the partition table does not always work. In such a case you need to inform the kernel about any new partitions by using \fBpartprobe\fP(8) or \fBpartx\fP(8), or by rebooting the system.
Move the cursor to the previous or next partition. If there are more partitions than can be displayed on a screen, you can display the next (previous) set of partitions by moving down (up) at the last (first) partition displayed on the screen.
.RE
.sp
\fILeft Arrow\fP, \fIRight Arrow\fP
.RS4
Select the preceding or the next menu item. Hitting \fIEnter\fP will execute the currently selected item.
.RE
.sp
All commands can be entered with either uppercase or lowercase letters (except for \fBW\fPrite). When in a submenu or at a prompt, you can hit the \fIEsc\fP key to return to the main menu.
.SH"COLORS"
.sp
The output colorization is implemented by \fBterminal\-colors.d\fP(5) functionality.
Implicit coloring can be disabled by an empty file
.RS3
.ll-.6i
.sp
\fI/etc/terminal\-colors.d/cfdisk.disable\fP
.br
.RE
.ll
.sp
for the \fBcfdisk\fP command or for all tools by
.RS3
.ll-.6i
.sp
\fI/etc/terminal\-colors.d/disable\fP
.br
.RE
.ll
.sp
The user\-specific \fI$XDG_CONFIG_HOME/terminal\-colors.d\fP
or \fI$HOME/.config/terminal\-colors.d\fP overrides the global setting.
.sp
Note that the output colorization may be enabled by default, and in this case
\fIterminal\-colors.d\fP directories do not have to exist yet.
.sp
\fBcfdisk\fP does not support color customization with a color\-scheme file.