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