cfdisk
(8)display or manipulate a disk partition table
Options
7-L--colorwhenColorize the output. The optional argument when can be auto, never or always. If the when argument is omitted, it defaults to auto. The colors can be disabled, for the current built-in default see --help output. See also the COLORS section.
--lockmodeUse exclusive BSD lock for device or file it operates. The optional argument mode can be yes, no (or 1 and 0) or nonblock. If the mode argument is omitted, it defaults to yes. This option overwrites environment variable $LOCK_BLOCK_DEVICE. The default is not to use any lock at all, but it’s recommended to avoid collisions with systemd-udevd(8) or other tools.
-r--read-onlyForced open in read-only mode.
-b--sector-sizesectorsizeSpecify the sector size of the disk. Valid values are 512, 1024, 2048, and 4096. The kernel is aware of the sector size for regular block devices. Use this option only on very old kernels, when working with disk images, or to override the kernel’s default sector size. Since util-linux-2.17, fdisk distinguishes between logical and physical sector size. This option changes both sector sizes to the specified sectorsize.
-z--zeroStart 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 sfdisk(8)-compatible script.
-h--helpDisplay help text and exit.
-V--versionDisplay version and exit.
DESCRIPTION
cfdisk is a curses-based program for partitioning any block device. The default device is /dev/sda.
Note that cfdisk provides basic partitioning functionality with a user-friendly interface. If you need advanced features, use fdisk(8) instead.
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.
Since version 2.25 cfdisk 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.
Since version 2.25 cfdisk also does not provide a 'print' command any more. This functionality is provided by the utilities partx(8) and lsblk(8) in a very comfortable and rich way.
If you want to remove an old partition table from a device, use wipefs(8).
COMMANDS
The commands for cfdisk can be entered by pressing the corresponding key (pressing Enter after the command is not necessary). Here is a list of the available commands:
b
d
h
n
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").
q
r
Note that reducing the size of a partition might destroy data on that partition.
s
t
u
The script files are compatible between cfdisk, fdisk(8) sfdisk(8) and other libfdisk applications. For more details see sfdisk(8).
It is also possible to load an sfdisk-script into cfdisk if there is no partition table on the device or when you start cfdisk with the --zero command-line option.
W
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 partprobe(8) or partx(8), or by rebooting the system.
x
Up Arrow, Down Arrow
Left Arrow, Right Arrow
All commands can be entered with either uppercase or lowercase letters (except for Write). When in a submenu or at a prompt, you can hit the Esc key to return to the main menu.
COLORS
The output colorization is implemented by terminal-colors.d(5) functionality. Implicit coloring can be disabled by an empty file
/etc/terminal-colors.d/cfdisk.disable
for the cfdisk command or for all tools by
/etc/terminal-colors.d/disable
Since version 2.41, the $NO_COLOR environment variable is also supported to disable output colorization unless explicitly enabled by a command-line option.
The user-specific $XDG_CONFIG_HOME/terminal-colors.d or $HOME/.config/terminal-colors.d overrides the global setting.
Note that the output colorization may be enabled by default, and in this case terminal-colors.d directories do not have to exist yet.
cfdisk does not support color customization with a color-scheme file.
ENVIRONMENT
CFDISK_DEBUG=all
LIBFDISK_DEBUG=all
LIBBLKID_DEBUG=all
LIBSMARTCOLS_DEBUG=all
LIBSMARTCOLS_DEBUG_PADDING=on
LOCK_BLOCK_DEVICE=<mode>
AUTHORS
Karel Zak kzak@redhat.com
The current cfdisk implementation is based on the original cfdisk from Kevin E. Martin martin@cs.unc.edu.
REPORTING BUGS
For bug reports, use the issue tracker https://github.com/util-linux/util-linux/issues.
AVAILABILITY
The cfdisk command is part of the util-linux package which can be downloaded from Linux Kernel Archive https://www.kernel.org/pub/linux/utils/util-linux/.