]> git.ipfire.org Git - thirdparty/util-linux.git/blame - fdisk/cfdisk.8
man pages: add "AVAILABILITY" section
[thirdparty/util-linux.git] / fdisk / cfdisk.8
CommitLineData
6dbe3af9
KZ
1.\" cfdisk.8 -- man page for cfdisk
2.\" Copyright 1994 Kevin E. Martin (martin@cs.unc.edu)
3.\"
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.
7.\"
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.
12.\"
13.\" " for hilit mode
726f69e2 14.TH CFDISK 8 "3 June 1995" "The BOGUS Linux Release" "Linux Programmer's Manual"
6dbe3af9
KZ
15.SH NAME
16cfdisk \- Curses based disk partition table manipulator for Linux
17.SH SYNOPSIS
7eda085c 18.BI "cfdisk [ \-agvz ] [ \-c " cylinders " ] [ \-h " heads " ]"
6dbe3af9
KZ
19.BI "[ \-s " sectors-per-track " ] [ -P " opt " ] [ " device " ]"
20.SH DESCRIPTION
21.B cfdisk
7eda085c
KZ
22is a curses based program for partitioning any hard disk drive.
23Typical values of the
6dbe3af9 24.I device
7eda085c 25argument are:
6dbe3af9
KZ
26.sp
27.nf
28.RS
29/dev/hda [default]
30/dev/hdb
31/dev/sda
32/dev/sdb
33/dev/sdc
34/dev/sdd
35.RE
36.fi
37
7eda085c 38In order to write the partition table
6dbe3af9 39.B cfdisk
7eda085c
KZ
40needs something called the `geometry' of the disk: the number
41of `heads' and the number of `sectors per track'. Linux does not
42use any geometry, so if the disk will not be accessed by other
43operating systems, you can safely accept the defaults that
6dbe3af9 44.B cfdisk
7eda085c
KZ
45chooses for you. The geometry used by
46.B cfdisk
47is found as follows. First the partition table is examined,
48to see what geometry was used by the previous program that
49changed it. If the partition table is empty, or contains garbage,
50or does not point at a consistent geometry, the kernel is
51asked for advice. If nothing works 255 heads and 63 sectors/track
52is assumed. The geometry can be overridden on the command line
53or by use of the `g' command. When partitioning an empty large modern
54disk, picking 255 heads and 63 sectors/track is always a good idea.
55There is no need to set the number of cylinders, since
56.B cfdisk
57knows the disk size.
58
59Next,
6dbe3af9
KZ
60.B cfdisk
61tries to read the current partition table from the disk drive. If it
62is unable to figure out the partition table, an error is displayed and
63the program will exit. This might also be caused by incorrect
64geometry information, and can be overridden on the command line.
65Another way around this problem is with the
66.B \-z
67option. This will ignore the partition table on the disk.
68
69The main display is composed of four sections, from top to bottom: the
70header, the partitions, the command line and a warning line. The
71header contains the program name and version number followed by the
72disk drive and its geometry. The partitions section always displays
73the current partition table. The command line is the place where
74commands and text are entered. The available commands are usually
75displayed in brackets. The warning line is usually empty except when
76there is important information to be displayed. The current partition
77is highlighted with reverse video (or an arrow if the
78.B \-a
79option is given). All partition specific commands apply to the
80current partition.
81
82The format of the partition table in the partitions section is, from
83left to right: Name, Flags, Partition Type, Filesystem Type and Size.
84The name is the partition device name. The flags can be
85.IR Boot ,
86which designates a bootable partition or
87.IR NC ,
88which stands for "Not Compatible with DOS or OS/2". DOS, OS/2 and
89possibly other operating systems require the first sector of the first
90partition on the disk and all logical partitions to begin on the
91second head. This wastes the second through the last sector of the
92first track of the first head (the first sector is taken by the
93partition table itself).
94.B cfdisk
95allows you to recover these "lost" sectors with the maximize command
96.RB ( m ).
97.I Note:
98.BR fdisk (8)
99and some early versions of DOS create all partitions with the number
100of sectors already maximized. For more information, see the maximize
101command below. The partition type can be one of
102.IR Primary " or " Logical .
103For unallocated space on the drive, the partition type can also be
104.IR Pri/Log ,
105or empty (if the space is unusable). The filesystem type section
106displays the name of the filesystem used on the partition, if known.
107If it is unknown, then
108.I Unknown
109and the hex value of the filesystem type are displayed. A special
110case occurs when there are sections of the disk drive that cannot be
111used (because all of the primary partitions are used). When this is
112detected, the filesystem type is displayed as
113.IR Unusable .
114The size field displays the size of the partition in megabytes (by
115default). It can also display the size in sectors and cylinders (see
116the change units command below). If an asterisks
117.RB ( * )
118appears after the size, this means that the partition is not aligned
119on cylinder boundaries.
120.SH "DOS 6.x WARNING"
121
122The DOS 6.x FORMAT command looks for some information in the first
123sector of the data area of the partition, and treats this information
124as more reliable than the information in the partition table. DOS
125FORMAT expects DOS FDISK to clear the first 512 bytes of the data area
126of a partition whenever a size change occurs. DOS FORMAT will look at
127this extra information even if the /U flag is given -- we consider
128this a bug in DOS FORMAT and DOS FDISK.
129
130The bottom line is that if you use cfdisk or fdisk to change the size of a
131DOS partition table entry, then you must also use
132.B dd
133to zero the first 512 bytes of that partition before using DOS FORMAT to
134format the partition. For example, if you were using cfdisk to make a DOS
135partition table entry for /dev/hda1, then (after exiting fdisk or cfdisk
136and rebooting Linux so that the partition table information is valid) you
137would use the command "dd if=/dev/zero of=/dev/hda1 bs=512 count=1" to zero
2b6fc908 138the first 512 bytes of the partition. Note:
6dbe3af9
KZ
139
140.B BE EXTREMELY CAREFUL
141if you use the
142.B dd
143command, since a small typo can make all of the data on your disk useless.
144
2b6fc908 145For best results, you should always use an OS-specific partition table
6dbe3af9
KZ
146program. For example, you should make DOS partitions with the DOS FDISK
147program and Linux partitions with the Linux fdisk or Linux cfdisk program.
148
149.SH COMMANDS
150.B cfdisk
151commands can be entered by pressing the desired key (pressing
152.I Enter
153after the command is not necessary). Here is a list of the available
154commands:
155.TP
156.B b
157Toggle bootable flag of the current partition. This allows you to
158select which primary partition is bootable on the drive.
159.TP
160.B d
161Delete the current partition. This will convert the current partition
162into free space and merge it with any free space immediately
163surrounding the current partition. A partition already marked as free
164space or marked as unusable cannot be deleted.
165.TP
166.B g
167Change the disk geometry (cylinders, heads, or sectors-per-track).
168.B WARNING:
169This option should only be used by people who know what they are
170doing. A command line option is also available to change the disk
171geometry. While at the change disk geometry command line, you can
172choose to change cylinders
173.RB ( c ),
174heads
175.RB ( h ),
176and sectors per track
177.RB ( s ).
178The default value will be printed at the prompt which you can accept
179by simply pressing the
180.I Enter
181key, or you can exit without changes by pressing the
182.I ESC
183key. If you want to change the default value, simply enter the
184desired value and press
185.IR Enter .
186The altered disk parameter values do not take effect until you return
187the main menu (by pressing
188.IR Enter " or " ESC
189at the change disk geometry command line. If you change the geometry
190such that the disk appears larger, the extra sectors are added at the
191end of the disk as free space. If the disk appears smaller, the
192partitions that are beyond the new last sector are deleted and the
193last partition on the drive (or the free space at the end of the
194drive) is made to end at the new last sector.
195.TP
196.B h
197Print the help screen.
198.TP
199.B m
200Maximize disk usage of the current partition. This command will
201recover the the unused space between the partition table and the
202beginning of the partition, but at the cost of making the partition
203incompatible with DOS, OS/2 and possibly other operating systems.
204This option will toggle between maximal disk usage and DOS, OS/2,
205etc. compatible disk usage. The default when creating a partition is
206to create DOS, OS/2, etc. compatible partitions.
207.TP
208.B n
209Create new partition from free space. If the partition type is
210.IR Primary " or " Logical ,
211a partition of that type will be created, but if the partition type is
212.IR Pri/Log ,
213you 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)
215since there can be only one extended partition, which contains all of
216the logical drives, all of the logical drives must be contiguous (with
217no intervening primary partition).
218.B cfdisk
219next prompts you for the size of the partition you want to create.
220The default size, equal to the entire free space of the current
221partition, is display in megabytes. You can either press the
222.I Enter
223key to accept the default size or enter a different size at the
224prompt.
225.B cfdisk
226accepts size entries in megabytes
227.RB ( M )
228[default], kilobytes
229.RB ( K ),
230cylinders
231.RB ( C )
232and sectors
233.RB ( S )
234by entering the number immediately followed by one of
235.RB ( M ", " K ", " C " or " S ).
236If the partition fills the free space available, the partition is
237created and you are returned to the main command line. Otherwise, the
238partition can be created at the beginning or the end of the free
239space, and
240.B cfdisk
241will ask you to choose where to place the partition. After the
242partition is created,
243.B cfdisk
244automatically adjusts the other partition's partition types if all of
245the primary partitions are used.
246.TP
247.B p
248Print the partition table to the screen or to a file. There are
249several different formats for the partition that you can choose from:
250.sp
251.RS
252.TP
253.B r
254Raw data format (exactly what would be written to disk)
255.TP
256.B s
257Partition table in sector order format
258.TP
259.B t
260Partition table in raw format
261.RE
262
263.RS
264The
265.I raw data format
266will print the sectors that would be written to disk if a
267.BR w rite
268command is selected. First, the primary partition table is printed,
269followed by the partition tables associated with each logical
270partition. The data is printed in hex byte by byte with 16 bytes per
271line.
272
273The
274.I partition table in sector order format
275will print the partition table ordered by sector number. The fields,
276from left to right, are the number of the partition, the partition
277type, the first sector, the last sector, the offset from the first
278sector of the partition to the start of the data, the length of the
279partition, the filesystem type (with the hex value in parenthesis),
280and the flags (with the hex value in parenthesis). In addition to the
281primary and logical partitions, free and unusable space is printed and
282the extended partition is printed before the first logical partition.
283
284If a partition does not start or end on a cylinder boundary or if the
285partition length is not divisible by the cylinder size, an asterisks
286.RB ( * )
287is printed after the non-aligned sector number/count. This usually
288indicates that a partition was created by an operating system that
289either does not align partitions to cylinder boundaries or that used
290different disk geometry information. If you know the disk geometry of
291the other operating system, you could enter the geometry information
292with the change geometry command
293.RB ( g ).
294
295For the first partition on the disk and for all logical partitions, if
296the offset from the beginning of the partition is not equal to the
297number of sectors per track (i.e., the data does not start on the
298first head), a number sign
299.RB ( # )
300is printed after the offset. For the remaining partitions, if the
301offset is not zero, a number sign will be printed after the offset.
302This corresponds to the
303.I NC
304flag in the partitions section of the main display.
305
306The
307.I partition table in raw format
308will print the partition table ordered by partition number. It will
309leave out all free and unusable space. The fields, from left to
310right, are the number of the partition, the flags (in hex), the
311starting head, sector and cylinder, the filesystem ID (in hex), the
312ending head, sector and cylinder, the starting sector in the partition
313and the number of sectors in the partition. The information in this
314table can be directly translated to the
315.IR "raw data format" .
316
317The partition table entries only have 10 bits available to represent
318the starting and ending cylinders. Thus, when the absolute starting
319(ending) sector number is on a cylinder greater than 1023, the maximal
320values for starting (ending) head, sector and cylinder are printed.
321This is the method used by OS/2, and thus fixes the problems
322associated with OS/2's fdisk rewriting the partition table when it is
323not in this format. Since Linux and OS/2 use absolute sector counts,
324the values in the starting and ending head, sector and cylinder are
325not used.
326.RE
327.TP
328.B q
329Quit program. This will exit the program without writing any data to
330disk.
331.TP
332.B t
333Change the filesystem type. By default, new partitions are created as
334.I Linux
335partitions, but since
336.B cfdisk
337can create partitions for other operating systems, change partition
338type allows you to enter the hex value of the filesystem you desire.
339A list of the know filesystem types is displayed. You can type in the
340filesystem type at the prompt or accept the default filesystem type
341.RI [ Linux ].
342.TP
343.B u
344Change units of the partition size display. It will rotate through
345megabytes, sectors and cylinders.
346.TP
347.B W
348Write partition table to disk (must enter an upper case W). Since
349this might destroy data on the disk, you must either confirm or deny
350the write by entering `yes' or `no'. If you enter `yes',
351.B cfdisk
352will write the partition table to disk and the tell the kernel to
353re-read the partition table from the disk. The re-reading of the
354partition table works is most cases, but I have seen it fail. Don't
355panic. It will be correct after you reboot the system. In all cases,
356I still recommend rebooting the system--just to be safe.
357.TP
358.I Up Arrow
359.TP
360.I Down Arrow
361Move cursor to the previous or next partition. If there are more
362partitions 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)
364partition displayed on the screen.
365.TP
366.I CTRL-L
367Redraws the screen. In case something goes wrong and you cannot read
368anything, you can refresh the screen from the main command line.
369.TP
370.B ?
371Print the help screen.
372
373.RE
374All of the commands can be entered with either upper or lower case
375letters (except for
376.BR W rites).
377When in a sub-menu or at a prompt to enter a filename, you can hit the
378.I ESC
379key to return to the main command line.
380.SH OPTIONS
381.TP
382.B \-a
383Use an arrow cursor instead of reverse video for highlighting the
384current partition.
385.TP
7eda085c
KZ
386.B \-g
387Do not use the geometry given by the disk driver, but try to
388guess a geometry from the partition table.
389.TP
6dbe3af9
KZ
390.B \-v
391Print the version number and copyright.
392.TP
393.B \-z
394Start with zeroed partition table. This option is useful when you
395want to repartition your entire disk.
396.I Note:
397this option does not zero the partition table on the disk; rather, it
398simply starts the program without reading the existing partition
399table.
400.TP
401.BI \-c " cylinders"
402.TP
403.BI \-h " heads"
404.TP
405.BI \-s " sectors-per-track"
406Override the number of cylinders, heads and sectors per track read
407from the BIOS. If your BIOS or adapter does not supply this
408information or if it supplies incorrect information, use these options
409to set the disk geometry values.
410.TP
411.BI \-P " opt"
412Prints the partition table in specified formats.
413.I opt
414can be one or more of "r", "s" or "t". See the
415.BR p rint
416command (above) for more information on the print formats.
5c36a0eb
KZ
417.SH "EXIT STATUS"
4180: No errors; 1: Invocation error; 2: I/O error;
4193: cannot get geometry; 4: bad partition table on disk.
6dbe3af9 420.SH "SEE ALSO"
612721db 421.BR fdisk (8),
63cccae4 422.BR mkfs (8),
612721db
KZ
423.BR parted (8),
424.BR sfdisk (8)
6dbe3af9 425.SH BUGS
5c36a0eb 426The current version does not support multiple disks.
6dbe3af9
KZ
427.SH AUTHOR
428Kevin E. Martin (martin@cs.unc.edu)
86d62711
KZ
429
430.SH AVAILABILITY
431The cfdisk command is part of the util-linux-ng package and is available from
432ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.