]> git.ipfire.org Git - thirdparty/util-linux.git/blob - disk-utils/cfdisk.8
cfdisk: add --lock and LOCK_BLOCK_DEVICE
[thirdparty/util-linux.git] / disk-utils / cfdisk.8
1 .\" cfdisk.8 -- man page for cfdisk
2 .\" Copyright 1994 Kevin E. Martin (martin@cs.unc.edu)
3 .\" Copyright (C) 2014 Karel Zak <kzak@redhat.com>
4 .\"
5 .\" Permission is granted to make and distribute verbatim copies of this
6 .\" manual provided the copyright notice and this permission notice are
7 .\" preserved on all copies.
8 .\"
9 .\" Permission is granted to copy and distribute modified versions of this
10 .\" manual under the conditions for verbatim copying, provided that the
11 .\" entire resulting derived work is distributed under the terms of a
12 .\" permission notice identical to this one.
13 .\"
14 .TH CFDISK 8 "March 2014" "util-linux" "System Administration"
15 .SH NAME
16 cfdisk \- display or manipulate a disk partition table
17 .SH SYNOPSIS
18 .B cfdisk
19 [options]
20 .RI [ device ]
21 .SH DESCRIPTION
22 .B cfdisk
23 is a curses-based program for partitioning any block device.
24 The default device is
25 .IR /dev/sda .
26
27 Note that
28 .B cfdisk
29 provides basic partitioning functionality with a user-friendly interface.
30 If you need advanced features, use
31 .BR fdisk (8)
32 instead.
33
34 Since version 2.25
35 .B cfdisk
36 supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any
37 functionality for CHS (Cylinder-Head-Sector) addressing. CHS has
38 never been important for Linux, and this addressing concept does not make any
39 sense for new devices.
40
41 Since version 2.25
42 .B cfdisk
43 also does not provide a 'print' command any more.
44 This functionality is provided by the utilities
45 .BR partx (8)
46 and
47 .BR lsblk (8)
48 in a very comfortable and rich way.
49
50 If you want to remove an old partition table from a device, use
51 .BR wipefs (8).
52
53 .SH OPTIONS
54 .TP
55 .BR \-h , " \-\-help"
56 Display help text and exit.
57 .TP
58 .BR \-L , " \-\-color" [ = \fIwhen\fR]
59 Colorize the output. The optional argument \fIwhen\fP
60 can be \fBauto\fR, \fBnever\fR or \fBalways\fR. If the \fIwhen\fR argument is omitted,
61 it defaults to \fBauto\fR. The colors can be disabled, for the current built-in default
62 see \fB\-\-help\fR output. See also the COLORS section.
63 .TP
64 \fB\-\-lock\fR[=\fImode\fR]
65 Use exclusive BSD lock for device or file it operates. The optional argument
66 \fImode\fP can be \fByes\fR, \fBno\fR (or 1 and 0) or \fBnonblock\fR. If the \fImode\fR
67 argument is omitted, it defaults to \fB"yes"\fR. This option overwrites
68 environment variable \fB$LOCK_BLOCK_DEVICE\fR. The default is not to use any
69 lock at all, but it's recommended to avoid collisions with udevd or other
70 tools.
71 .TP
72 .BR \-V , " \-\-version"
73 Display version information and exit.
74 .TP
75 .BR \-z , " \-\-zero"
76 Start with an in-memory zeroed partition table. This option does not zero the
77 partition table on the disk; rather, it simply starts the program without
78 reading the existing partition table. This option allows you to create a new
79 partition table from scratch or from an sfdisk-compatible script.
80
81 .SH COMMANDS
82 The commands for
83 .B cfdisk
84 can be entered by pressing the corresponding key (pressing
85 .I Enter
86 after the command is not necessary). Here is a list of the available
87 commands:
88 .TP
89 .B b
90 Toggle the bootable flag of the current partition. This allows you to
91 select which primary partition is bootable on the drive. This command may not
92 be available for all partition label types.
93 .TP
94 .B d
95 Delete the current partition. This will convert the current partition
96 into free space and merge it with any free space immediately
97 surrounding the current partition. A partition already marked as free
98 space or marked as unusable cannot be deleted.
99 .TP
100 .B h
101 Show the help screen.
102 .TP
103 .B n
104 Create a new partition from free space.
105 .B cfdisk
106 then prompts you for the size of the partition you want to create.
107 The default size is equal to the entire available free space at the current
108 position.
109
110 The size may be followed by a multiplicative suffix: KiB (=1024),
111 MiB (=1024*1024), and so on for GiB, TiB, PiB, EiB, ZiB and YiB
112 (the "iB" is optional, e.g., "K" has the same meaning as "KiB").
113 .TP
114 .B q
115 Quit the program. This will exit the program without writing any data to
116 the disk.
117 .TP
118 .B s
119 Sort the partitions in ascending start-sector order. When deleting and
120 adding partitions, it is likely that the numbering of the partitions will
121 no longer match their order on the disk. This command restores that match.
122 .TP
123 .B t
124 Change the partition type. By default, new partitions are created as
125 .I Linux
126 partitions.
127 .TP
128 .B u
129 Dump the current in-memory partition table to an sfdisk-compatible script file.
130 .sp
131 The script files are compatible between \fBcfdisk\fR, \fBfdisk\fR, \fBsfdisk\fR
132 and other libfdisk applications. For more details see
133 .BR sfdisk (8).
134 .sp
135 It is also possible to load an sfdisk-script into \fBcfdisk\fR if there is
136 no partition table on the device or when you start \fBcfdisk\fR with the
137 \fB--zero\fR command-line option.
138 .TP
139 .B W
140 Write the partition table to disk (you must enter an uppercase W). Since
141 this might destroy data on the disk, you must either confirm or deny
142 the write by entering `yes' or `no'. If you enter `yes',
143 .B cfdisk
144 will write the partition table to disk and then tell the kernel to re-read the
145 partition table from the disk.
146
147 The re-reading of the partition table does not always work. In such a
148 case you need to inform the kernel about any new partitions by using
149 .BR partprobe (8)
150 or
151 .BR partx (8),
152 or by rebooting the system.
153 .TP
154 .B x
155 Toggle extra information about a partition.
156 .TP
157 .IR "Up Arrow" , " Down Arrow"
158 Move the cursor to the previous or next partition. If there are more
159 partitions than can be displayed on a screen, you can display the next
160 (previous) set of partitions by moving down (up) at the last (first)
161 partition displayed on the screen.
162 .TP
163 .IR "Left Arrow" , " Right Arrow"
164 Select the preceding or the next menu item. Hitting \fIEnter\fR will
165 execute the currently selected item.
166
167 .PP
168 All commands can be entered with either uppercase or lowercase
169 letters (except for
170 .BR W rite).
171 When in a submenu or at a prompt, you can hit the
172 .I Esc
173 key to return to the main menu.
174
175 .SH COLORS
176 Implicit coloring can be disabled by creating the empty file
177 .IR /etc/terminal-colors.d/cfdisk.disable .
178
179 See
180 .BR terminal-colors.d (5)
181 for more details about colorization configuration.
182
183 .B cfdisk
184 does not support color customization with a color-scheme file.
185
186 .SH ENVIRONMENT
187 .IP CFDISK_DEBUG=all
188 enables cfdisk debug output.
189 .IP LIBFDISK_DEBUG=all
190 enables libfdisk debug output.
191 .IP LIBBLKID_DEBUG=all
192 enables libblkid debug output.
193 .IP LIBSMARTCOLS_DEBUG=all
194 enables libsmartcols debug output.
195 .IP LIBSMARTCOLS_DEBUG_PADDING=on
196 use visible padding characters. Requires enabled LIBSMARTCOLS_DEBUG.
197 .IP LOCK_BLOCK_DEVICE=<mode>
198 use exclusive BSD lock. The mode is "1" or "0". See \fB\-\-lock\fR for more details.
199
200 .SH AUTHORS
201 Karel Zak <kzak@redhat.com>
202 .PP
203 The current cfdisk implementation is based on the original cfdisk
204 from Kevin E. Martin (martin@cs.unc.edu).
205
206 .SH SEE ALSO
207 .BR fdisk (8),
208 .BR parted (8),
209 .BR partprobe (8),
210 .BR partx (8),
211 .BR sfdisk (8)
212 .SH AVAILABILITY
213 The cfdisk command is part of the util-linux package and is available from
214 https://www.kernel.org/pub/linux/utils/util-linux/.