OSDN Git Service

Import translated manuals from JM CVS Repository.
[linuxjm/jm.git] / manual / util-linux / original / man8 / cfdisk.8
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 "3 June 1995" "The BOGUS Linux Release" "Linux Programmer's Manual"
15 .SH NAME
16 cfdisk \- Curses based disk partition table manipulator for Linux
17 .SH SYNOPSIS
18 .BI "cfdisk [ \-agvz ] [ \-c " cylinders " ] [ \-h " heads " ]"
19 .BI "[ \-s " sectors-per-track " ] [ -P " opt " ] [ " device " ]"
20 .SH DESCRIPTION
21 .B cfdisk
22 is a curses based program for partitioning any hard disk drive.
23 Typical values of the
24 .I device
25 argument are:
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
38 In order to write the partition table
39 .B cfdisk
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
44 .B cfdisk
45 chooses for you. The geometry used by
46 .B cfdisk
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
56 .B cfdisk
57 knows the disk size.
58
59 Next,
60 .B cfdisk
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
66 .B \-z
67 option.  This will ignore the partition table on the disk.
68
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
78 .B \-a
79 option is given).  All partition specific commands apply to the
80 current partition.
81
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
85 .IR Boot ,
86 which designates a bootable partition or
87 .IR NC ,
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).
94 .B cfdisk
95 allows you to recover these "lost" sectors with the maximize command
96 .RB ( m ).
97 .I Note:
98 .BR fdisk (8)
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
104 .IR Pri/Log ,
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
108 .I Unknown
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
113 .IR Unusable .
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
117 .RB ( * )
118 appears after the size, this means that the partition is not aligned
119 on cylinder boundaries.
120 .SH "DOS 6.x WARNING"
121
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.
129
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
132 .B dd
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:
139
140 .B BE EXTREMELY CAREFUL
141 if you use the
142 .B dd
143 command, since a small typo can make all of the data on your disk useless.
144
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.
148
149 .SH COMMANDS
150 .B cfdisk
151 commands can be entered by pressing the desired key (pressing
152 .I Enter
153 after the command is not necessary).  Here is a list of the available
154 commands:
155 .TP
156 .B b
157 Toggle bootable flag of the current partition.  This allows you to
158 select which primary partition is bootable on the drive.
159 .TP
160 .B d
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.
165 .TP
166 .B g
167 Change the disk geometry (cylinders, heads, or sectors-per-track).
168 .B WARNING:
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
173 .RB ( c ),
174 heads
175 .RB ( h ),
176 and sectors per track
177 .RB ( s ).
178 The default value will be printed at the prompt which you can accept
179 by simply pressing the
180 .I Enter
181 key, or you can exit without changes by pressing the
182 .I ESC
183 key.  If you want to change the default value, simply enter the
184 desired value and press
185 .IR Enter .
186 The altered disk parameter values do not take effect until you return
187 the main menu (by pressing
188 .IR Enter " or " ESC
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.
195 .TP
196 .B h
197 Print the help screen.
198 .TP
199 .B m
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.
207 .TP
208 .B n
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
212 .IR Pri/Log ,
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).
218 .B cfdisk
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
222 .I Enter
223 key to accept the default size or enter a different size at the
224 prompt.
225 .B cfdisk
226 accepts size entries in megabytes
227 .RB ( M )
228 [default], kilobytes
229 .RB ( K ),
230 cylinders
231 .RB ( C )
232 and sectors
233 .RB ( S )
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
239 space, and
240 .B cfdisk
241 will ask you to choose where to place the partition.  After the
242 partition is created,
243 .B cfdisk
244 automatically adjusts the other partition's partition types if all of
245 the primary partitions are used.
246 .TP
247 .B p
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:
250 .sp
251 .RS
252 .TP
253 .B r
254 Raw data format (exactly what would be written to disk)
255 .TP
256 .B s
257 Partition table in sector order format
258 .TP
259 .B t
260 Partition table in raw format
261 .RE
262
263 .RS
264 The
265 .I raw data format
266 will print the sectors that would be written to disk if a
267 .BR w rite
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
271 line.
272
273 The
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.
283
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
286 .RB ( * )
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
293 .RB ( g ).
294
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
299 .RB ( # )
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
303 .I NC
304 flag in the partitions section of the main display.
305
306 The
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" .
316
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
325 not used.
326 .RE
327 .TP
328 .B q
329 Quit program.  This will exit the program without writing any data to
330 disk.
331 .TP
332 .B t
333 Change the filesystem type.  By default, new partitions are created as
334 .I Linux
335 partitions, but since
336 .B cfdisk
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
341 .RI [ Linux ].
342 .TP
343 .B u
344 Change units of the partition size display.  It will rotate through
345 megabytes, sectors and cylinders.
346 .TP
347 .B W
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',
351 .B cfdisk
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.
357 .TP
358 .I Up Arrow
359 .TP
360 .I Down Arrow
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.
365 .TP
366 .I CTRL-L
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.
369 .TP
370 .B ?
371 Print the help screen.
372
373 .RE
374 All of the commands can be entered with either upper or lower case
375 letters (except for
376 .BR W rites).
377 When in a sub-menu or at a prompt to enter a filename, you can hit the
378 .I ESC
379 key to return to the main command line.
380 .SH OPTIONS
381 .TP
382 .B \-a
383 Use an arrow cursor instead of reverse video for highlighting the
384 current partition.
385 .TP
386 .B \-g
387 Do not use the geometry given by the disk driver, but try to
388 guess a geometry from the partition table.
389 .TP
390 .B \-v
391 Print the version number and copyright.
392 .TP
393 .B \-z
394 Start with zeroed partition table.  This option is useful when you
395 want to repartition your entire disk.
396 .I Note:
397 this option does not zero the partition table on the disk; rather, it
398 simply starts the program without reading the existing partition
399 table.
400 .TP
401 .BI \-c " cylinders"
402 .TP
403 .BI \-h " heads"
404 .TP
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.
410 .TP
411 .BI \-P " opt"
412 Prints the partition table in specified formats.
413 .I opt
414 can be one or more of "r", "s" or "t".  See the
415 .BR p rint
416 command (above) for more information on the print formats.
417 .SH "EXIT STATUS"
418 0: No errors; 1: Invocation error; 2: I/O error;
419 3: cannot get geometry; 4: bad partition table on disk.
420 .SH "SEE ALSO"
421 .BR fdisk (8),
422 .BR mkfs (8),
423 .BR parted (8),
424 .BR sfdisk (8)
425 .SH BUGS
426 The current version does not support multiple disks.
427 .SH AUTHOR
428 Kevin E. Martin (martin@cs.unc.edu)