summaryrefslogtreecommitdiffstats
path: root/disk-utils/cfdisk.8
blob: a61aad71f31df03a473ddb23e16d9c76dfcfd7dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
.\" cfdisk.8 -- man page for cfdisk
.\" Copyright 1994 Kevin E. Martin (martin@cs.unc.edu)
.\" Copyright (C) 2014 Karel Zak <kzak@redhat.com>
.\"
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Permission is granted to copy and distribute modified versions of this
.\" manual under the conditions for verbatim copying, provided that the
.\" entire resulting derived work is distributed under the terms of a
.\" permission notice identical to this one.
.\"
.TH CFDISK 8 "March 2014" "util-linux" "System Administration"
.SH NAME
cfdisk \- display or manipulate a disk partition table
.SH SYNOPSIS
.B cfdisk
[options]
.RI [ device ]
.SH DESCRIPTION
.B cfdisk
is a curses-based program for partitioning any block device.
The default device is
.IR /dev/sda .

Note that
.B cfdisk
provides basic partitioning functionality with a user-friendly interface.
If you need advanced features, use
.BR fdisk (8)
instead.

Since version 2.25
.B 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
.B cfdisk
also does not provide a 'print' command any more.
This functionality is provided by the utilities
.BR partx (8)
and
.BR lsblk (8)
in a very comfortable and rich way.

If you want to remove an old partition table from a device, use
.BR wipefs (8).

.SH OPTIONS
.TP
.BR \-h , " \-\-help"
Display help text and exit.
.TP
.BR \-L , " \-\-color" [ = \fIwhen\fR]
Colorize the output.  The optional argument \fIwhen\fP
can be \fBauto\fR, \fBnever\fR or \fBalways\fR.  If the \fIwhen\fR argument is omitted,
it defaults to \fBauto\fR.  The colors can be disabled, for the current built-in default
see \fB\-\-help\fR output. See also the COLORS section.
.TP
\fB\-\-lock\fR[=\fImode\fR]
Use exclusive BSD lock for device or file it operates.  The optional argument
\fImode\fP can be \fByes\fR, \fBno\fR (or 1 and 0) or \fBnonblock\fR.  If the \fImode\fR
argument is omitted, it defaults to \fB"yes"\fR.  This option overwrites
environment variable \fB$LOCK_BLOCK_DEVICE\fR.  The default is not to use any
lock at all, but it's recommended to avoid collisions with udevd or other
tools.
.TP
.BR \-V , " \-\-version"
Display version information and exit.
.TP
.BR \-z , " \-\-zero"
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 sfdisk-compatible script.

.SH COMMANDS
The commands for
.B cfdisk
can be entered by pressing the corresponding key (pressing
.I Enter
after the command is not necessary).  Here is a list of the available
commands:
.TP
.B b
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.
.TP
.B d
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.
.TP
.B h
Show the help screen.
.TP
.B n
Create a new partition from free space.
.B cfdisk
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.

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").
.TP
.B q
Quit the program.  This will exit the program without writing any data to
the disk.
.TP
.B s
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.
.TP
.B t
Change the partition type.  By default, new partitions are created as
.I Linux
partitions.
.TP
.B u
Dump the current in-memory partition table to an sfdisk-compatible script file.
.sp
The script files are compatible between \fBcfdisk\fR, \fBfdisk\fR, \fBsfdisk\fR
and other libfdisk applications.  For more details see
.BR sfdisk (8).
.sp
It is also possible to load an sfdisk-script into \fBcfdisk\fR if there is
no partition table on the device or when you start \fBcfdisk\fR with the
\fB--zero\fR command-line option.
.TP
.B W
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' or `no'.  If you enter `yes',
.B cfdisk
will write the partition table to disk and then tell the kernel to re-read the
partition table from the disk.

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
.BR partprobe (8)
or
.BR partx (8),
or by rebooting the system.
.TP
.B x
Toggle extra information about a partition.
.TP
.IR "Up Arrow" , " Down Arrow"
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.
.TP
.IR "Left Arrow" , " Right Arrow"
Select the preceding or the next menu item.  Hitting \fIEnter\fR will
execute the currently selected item.

.PP
All commands can be entered with either uppercase or lowercase
letters (except for
.BR W rite).
When in a submenu or at a prompt, you can hit the
.I Esc
key to return to the main menu.

.SH COLORS
Implicit coloring can be disabled by creating the empty file
.IR /etc/terminal-colors.d/cfdisk.disable .

See
.BR terminal-colors.d (5)
for more details about colorization configuration.

.B cfdisk
does not support color customization with a color-scheme file.

.SH ENVIRONMENT
.IP CFDISK_DEBUG=all
enables cfdisk debug output.
.IP LIBFDISK_DEBUG=all
enables libfdisk debug output.
.IP LIBBLKID_DEBUG=all
enables libblkid debug output.
.IP LIBSMARTCOLS_DEBUG=all
enables libsmartcols debug output.
.IP LIBSMARTCOLS_DEBUG_PADDING=on
use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
.IP LOCK_BLOCK_DEVICE=<mode>
use exclusive BSD lock.  The mode is "1" or "0".  See \fB\-\-lock\fR for more details.

.SH AUTHORS
Karel Zak <kzak@redhat.com>
.PP
The current cfdisk implementation is based on the original cfdisk
from Kevin E. Martin (martin@cs.unc.edu).

.SH SEE ALSO
.BR fdisk (8),
.BR parted (8),
.BR partprobe (8),
.BR partx (8),
.BR sfdisk (8)
.SH AVAILABILITY
The cfdisk command is part of the util-linux package and is available from
https://www.kernel.org/pub/linux/utils/util-linux/.