summaryrefslogtreecommitdiffstats
path: root/disk-utils/cfdisk.8
blob: 2e518b7159109f329b45b5451748e40de3234f2c (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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
'\" t
.\"     Title: cfdisk
.\"    Author: [see the "AUTHOR(S)" section]
.\" Generator: Asciidoctor 2.0.20
.\"      Date: 2023-10-23
.\"    Manual: System Administration
.\"    Source: util-linux 2.39.3
.\"  Language: English
.\"
.TH "CFDISK" "8" "2023-10-23" "util\-linux 2.39.3" "System Administration"
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.ss \n[.ss] 0
.nh
.ad l
.de URL
\fI\\$2\fP <\\$1>\\$3
..
.als MTO URL
.if \n[.g] \{\
.  mso www.tmac
.  am URL
.    ad l
.  .
.  am MTO
.    ad l
.  .
.  LINKSTYLE blue R < >
.\}
.SH "NAME"
cfdisk \- display or manipulate a disk partition table
.SH "SYNOPSIS"
.sp
\fBcfdisk\fP [options] [\fIdevice\fP]
.SH "DESCRIPTION"
.sp
\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).
.SH "OPTIONS"
.sp
\fB\-h\fP, \fB\-\-help\fP
.RS 4
Display help text and exit.
.RE
.sp
\fB\-V\fP, \fB\-\-version\fP
.RS 4
Print version and exit.
.RE
.sp
\fB\-L\fP, \fB\-\-color\fP[\fB=\fP\fIwhen\fP]
.RS 4
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]
.RS 4
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
.RS 4
Forced open in read\-only mode.
.RE
.sp
\fB\-z\fP, \fB\-\-zero\fP
.RS 4
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
.RS 4
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
.RS 4
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.
.RE
.sp
\fBh\fP
.RS 4
Show the help screen.
.RE
.sp
\fBn\fP
.RS 4
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
.RS 4
Quit the program. This will exit the program without writing any data to the disk.
.RE
.sp
\fBr\fP
.RS 4
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
.RS 4
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
.RS 4
Change the partition type. By default, new partitions are created as \fILinux\fP partitions.
.RE
.sp
\fBu\fP
.RS 4
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
.RS 4
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.
.RE
.sp
\fBx\fP
.RS 4
Toggle extra information about a partition.
.RE
.sp
\fIUp Arrow\fP, \fIDown Arrow\fP
.RS 4
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
.RS 4
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
.RS 3
.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
.RS 3
.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.
.SH "ENVIRONMENT"
.sp
\fBCFDISK_DEBUG\fP=all
.RS 4
enables cfdisk debug output.
.RE
.sp
\fBLIBFDISK_DEBUG\fP=all
.RS 4
enables libfdisk debug output.
.RE
.sp
\fBLIBBLKID_DEBUG\fP=all
.RS 4
enables libblkid debug output.
.RE
.sp
\fBLIBSMARTCOLS_DEBUG\fP=all
.RS 4
enables libsmartcols debug output.
.RE
.sp
\fBLIBSMARTCOLS_DEBUG_PADDING\fP=on
.RS 4
use visible padding characters. Requires enabled \fBLIBSMARTCOLS_DEBUG\fP.
.RE
.sp
\fBLOCK_BLOCK_DEVICE\fP=<mode>
.RS 4
use exclusive BSD lock. The mode is "1" or "0". See \fB\-\-lock\fP for more details.
.RE
.SH "AUTHORS"
.sp
.MTO "kzak\(atredhat.com" "Karel Zak" ""
.sp
The current \fBcfdisk\fP implementation is based on the original \fBcfdisk\fP from \c
.MTO "martin\(atcs.unc.edu" "Kevin E. Martin" "."
.SH "SEE ALSO"
.sp
\fBfdisk\fP(8),
\fBparted\fP(8),
\fBpartprobe\fP(8),
\fBpartx\fP(8),
\fBsfdisk\fP(8)
.SH "REPORTING BUGS"
.sp
For bug reports, use the issue tracker at \c
.URL "https://github.com/util\-linux/util\-linux/issues" "" "."
.SH "AVAILABILITY"
.sp
The \fBcfdisk\fP command is part of the util\-linux package which can be downloaded from \c
.URL "https://www.kernel.org/pub/linux/utils/util\-linux/" "Linux Kernel Archive" "."