1 .\" cfdisk.8 -- man page for cfdisk
2 .\" Copyright 1994 Kevin E. Martin (martin@cs.unc.edu)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
14 .TH CFDISK 8 "3 June 1995" "The BOGUS Linux Release" "Linux Programmer's Manual"
16 cfdisk \- Curses based disk partition table manipulator for Linux
18 .BI "cfdisk [ \-agvz ] [ \-c " cylinders " ] [ \-h " heads " ]"
19 .BI "[ \-s " sectors-per-track " ] [ -P " opt " ] [ " device " ]"
22 is a curses based program for partitioning any hard disk drive.
38 In order to write the partition table
40 needs something called the `geometry' of the disk: the number
41 of `heads' and the number of `sectors per track'. Linux does not
42 use any geometry, so if the disk will not be accessed by other
43 operating systems, you can safely accept the defaults that
45 chooses for you. The geometry used by
47 is found as follows. First the partition table is examined,
48 to see what geometry was used by the previous program that
49 changed it. If the partition table is empty, or contains garbage,
50 or does not point at a consistent geometry, the kernel is
51 asked for advice. If nothing works 255 heads and 63 sectors/track
52 is assumed. The geometry can be overridden on the command line
53 or by use of the `g' command. When partitioning an empty large modern
54 disk, picking 255 heads and 63 sectors/track is always a good idea.
55 There is no need to set the number of cylinders, since
61 tries to read the current partition table from the disk drive. If it
62 is unable to figure out the partition table, an error is displayed and
63 the program will exit. This might also be caused by incorrect
64 geometry information, and can be overridden on the command line.
65 Another way around this problem is with the
67 option. This will ignore the partition table on the disk.
69 The main display is composed of four sections, from top to bottom: the
70 header, the partitions, the command line and a warning line. The
71 header contains the program name and version number followed by the
72 disk drive and its geometry. The partitions section always displays
73 the current partition table. The command line is the place where
74 commands and text are entered. The available commands are usually
75 displayed in brackets. The warning line is usually empty except when
76 there is important information to be displayed. The current partition
77 is highlighted with reverse video (or an arrow if the
79 option is given). All partition specific commands apply to the
82 The format of the partition table in the partitions section is, from
83 left to right: Name, Flags, Partition Type, Filesystem Type and Size.
84 The name is the partition device name. The flags can be
86 which designates a bootable partition or
88 which stands for "Not Compatible with DOS or OS/2". DOS, OS/2 and
89 possibly other operating systems require the first sector of the first
90 partition on the disk and all logical partitions to begin on the
91 second head. This wastes the second through the last sector of the
92 first track of the first head (the first sector is taken by the
93 partition table itself).
95 allows you to recover these "lost" sectors with the maximize command
99 and some early versions of DOS create all partitions with the number
100 of sectors already maximized. For more information, see the maximize
101 command below. The partition type can be one of
102 .IR Primary " or " Logical .
103 For unallocated space on the drive, the partition type can also be
105 or empty (if the space is unusable). The filesystem type section
106 displays the name of the filesystem used on the partition, if known.
107 If it is unknown, then
109 and the hex value of the filesystem type are displayed. A special
110 case occurs when there are sections of the disk drive that cannot be
111 used (because all of the primary partitions are used). When this is
112 detected, the filesystem type is displayed as
114 The size field displays the size of the partition in megabytes (by
115 default). It can also display the size in sectors and cylinders (see
116 the change units command below). If an asterisks
118 appears after the size, this means that the partition is not aligned
119 on cylinder boundaries.
120 .SH "DOS 6.x WARNING"
122 The DOS 6.x FORMAT command looks for some information in the first
123 sector of the data area of the partition, and treats this information
124 as more reliable than the information in the partition table. DOS
125 FORMAT expects DOS FDISK to clear the first 512 bytes of the data area
126 of a partition whenever a size change occurs. DOS FORMAT will look at
127 this extra information even if the /U flag is given -- we consider
128 this a bug in DOS FORMAT and DOS FDISK.
130 The bottom line is that if you use cfdisk or fdisk to change the size of a
131 DOS partition table entry, then you must also use
133 to zero the first 512 bytes of that partition before using DOS FORMAT to
134 format the partition. For example, if you were using cfdisk to make a DOS
135 partition table entry for /dev/hda1, then (after exiting fdisk or cfdisk
136 and rebooting Linux so that the partition table information is valid) you
137 would use the command "dd if=/dev/zero of=/dev/hda1 bs=512 count=1" to zero
138 the first 512 bytes of the partition. Note:
140 .B BE EXTREMELY CAREFUL
143 command, since a small typo can make all of the data on your disk useless.
145 For best results, you should always use an OS-specific partition table
146 program. For example, you should make DOS partitions with the DOS FDISK
147 program and Linux partitions with the Linux fdisk or Linux cfdisk program.
151 commands can be entered by pressing the desired key (pressing
153 after the command is not necessary). Here is a list of the available
157 Toggle bootable flag of the current partition. This allows you to
158 select which primary partition is bootable on the drive.
161 Delete the current partition. This will convert the current partition
162 into free space and merge it with any free space immediately
163 surrounding the current partition. A partition already marked as free
164 space or marked as unusable cannot be deleted.
167 Change the disk geometry (cylinders, heads, or sectors-per-track).
169 This option should only be used by people who know what they are
170 doing. A command line option is also available to change the disk
171 geometry. While at the change disk geometry command line, you can
172 choose to change cylinders
176 and sectors per track
178 The default value will be printed at the prompt which you can accept
179 by simply pressing the
181 key, or you can exit without changes by pressing the
183 key. If you want to change the default value, simply enter the
184 desired value and press
186 The altered disk parameter values do not take effect until you return
187 the main menu (by pressing
189 at the change disk geometry command line. If you change the geometry
190 such that the disk appears larger, the extra sectors are added at the
191 end of the disk as free space. If the disk appears smaller, the
192 partitions that are beyond the new last sector are deleted and the
193 last partition on the drive (or the free space at the end of the
194 drive) is made to end at the new last sector.
197 Print the help screen.
200 Maximize disk usage of the current partition. This command will
201 recover the the unused space between the partition table and the
202 beginning of the partition, but at the cost of making the partition
203 incompatible with DOS, OS/2 and possibly other operating systems.
204 This option will toggle between maximal disk usage and DOS, OS/2,
205 etc. compatible disk usage. The default when creating a partition is
206 to create DOS, OS/2, etc. compatible partitions.
209 Create new partition from free space. If the partition type is
210 .IR Primary " or " Logical ,
211 a partition of that type will be created, but if the partition type is
213 you will be prompted for the type you want to create. Be aware that
214 (1) there are only four slots available for primary partitions and (2)
215 since there can be only one extended partition, which contains all of
216 the logical drives, all of the logical drives must be contiguous (with
217 no intervening primary partition).
219 next prompts you for the size of the partition you want to create.
220 The default size, equal to the entire free space of the current
221 partition, is display in megabytes. You can either press the
223 key to accept the default size or enter a different size at the
226 accepts size entries in megabytes
234 by entering the number immediately followed by one of
235 .RB ( M ", " K ", " C " or " S ).
236 If the partition fills the free space available, the partition is
237 created and you are returned to the main command line. Otherwise, the
238 partition can be created at the beginning or the end of the free
241 will ask you to choose where to place the partition. After the
242 partition is created,
244 automatically adjusts the other partition's partition types if all of
245 the primary partitions are used.
248 Print the partition table to the screen or to a file. There are
249 several different formats for the partition that you can choose from:
254 Raw data format (exactly what would be written to disk)
257 Partition table in sector order format
260 Partition table in raw format
266 will print the sectors that would be written to disk if a
268 command is selected. First, the primary partition table is printed,
269 followed by the partition tables associated with each logical
270 partition. The data is printed in hex byte by byte with 16 bytes per
274 .I partition table in sector order format
275 will print the partition table ordered by sector number. The fields,
276 from left to right, are the number of the partition, the partition
277 type, the first sector, the last sector, the offset from the first
278 sector of the partition to the start of the data, the length of the
279 partition, the filesystem type (with the hex value in parenthesis),
280 and the flags (with the hex value in parenthesis). In addition to the
281 primary and logical partitions, free and unusable space is printed and
282 the extended partition is printed before the first logical partition.
284 If a partition does not start or end on a cylinder boundary or if the
285 partition length is not divisible by the cylinder size, an asterisks
287 is printed after the non-aligned sector number/count. This usually
288 indicates that a partition was created by an operating system that
289 either does not align partitions to cylinder boundaries or that used
290 different disk geometry information. If you know the disk geometry of
291 the other operating system, you could enter the geometry information
292 with the change geometry command
295 For the first partition on the disk and for all logical partitions, if
296 the offset from the beginning of the partition is not equal to the
297 number of sectors per track (i.e., the data does not start on the
298 first head), a number sign
300 is printed after the offset. For the remaining partitions, if the
301 offset is not zero, a number sign will be printed after the offset.
302 This corresponds to the
304 flag in the partitions section of the main display.
307 .I partition table in raw format
308 will print the partition table ordered by partition number. It will
309 leave out all free and unusable space. The fields, from left to
310 right, are the number of the partition, the flags (in hex), the
311 starting head, sector and cylinder, the filesystem ID (in hex), the
312 ending head, sector and cylinder, the starting sector in the partition
313 and the number of sectors in the partition. The information in this
314 table can be directly translated to the
315 .IR "raw data format" .
317 The partition table entries only have 10 bits available to represent
318 the starting and ending cylinders. Thus, when the absolute starting
319 (ending) sector number is on a cylinder greater than 1023, the maximal
320 values for starting (ending) head, sector and cylinder are printed.
321 This is the method used by OS/2, and thus fixes the problems
322 associated with OS/2's fdisk rewriting the partition table when it is
323 not in this format. Since Linux and OS/2 use absolute sector counts,
324 the values in the starting and ending head, sector and cylinder are
329 Quit program. This will exit the program without writing any data to
333 Change the filesystem type. By default, new partitions are created as
335 partitions, but since
337 can create partitions for other operating systems, change partition
338 type allows you to enter the hex value of the filesystem you desire.
339 A list of the know filesystem types is displayed. You can type in the
340 filesystem type at the prompt or accept the default filesystem type
344 Change units of the partition size display. It will rotate through
345 megabytes, sectors and cylinders.
348 Write partition table to disk (must enter an upper case W). Since
349 this might destroy data on the disk, you must either confirm or deny
350 the write by entering `yes' or `no'. If you enter `yes',
352 will write the partition table to disk and the tell the kernel to
353 re-read the partition table from the disk. The re-reading of the
354 partition table works is most cases, but I have seen it fail. Don't
355 panic. It will be correct after you reboot the system. In all cases,
356 I still recommend rebooting the system--just to be safe.
361 Move cursor to the previous or next partition. If there are more
362 partitions than can be displayed on a screen, you can display the next
363 (previous) set of partitions by moving down (up) at the last (first)
364 partition displayed on the screen.
367 Redraws the screen. In case something goes wrong and you cannot read
368 anything, you can refresh the screen from the main command line.
371 Print the help screen.
374 All of the commands can be entered with either upper or lower case
377 When in a sub-menu or at a prompt to enter a filename, you can hit the
379 key to return to the main command line.
383 Use an arrow cursor instead of reverse video for highlighting the
387 Do not use the geometry given by the disk driver, but try to
388 guess a geometry from the partition table.
391 Print the version number and copyright.
394 Start with zeroed partition table. This option is useful when you
395 want to repartition your entire disk.
397 this option does not zero the partition table on the disk; rather, it
398 simply starts the program without reading the existing partition
405 .BI \-s " sectors-per-track"
406 Override the number of cylinders, heads and sectors per track read
407 from the BIOS. If your BIOS or adapter does not supply this
408 information or if it supplies incorrect information, use these options
409 to set the disk geometry values.
412 Prints the partition table in specified formats.
414 can be one or more of "r", "s" or "t". See the
416 command (above) for more information on the print formats.
418 0: No errors; 1: Invocation error; 2: I/O error;
419 3: cannot get geometry; 4: bad partition table on disk.
426 The current version does not support multiple disks.
428 Kevin E. Martin (martin@cs.unc.edu)