-->
Page 1266
DESCRIPTION
cfdisk is a curses-based program for partitioning a hard disk drive. The device can be any one of the following:
/dev/hda [default] /dev/hdb /dev/sda /dev/sdb /dev/sdc /dev/sdd
cfdisk first tries to read the geometry of the hard disk. If it fails, an error message is displayed and cfdisk exits. This should only happen when partitioning a SCSI drive on an adapter without a BIOS. To correct this problem, you can set the cylinders, heads, and sectors-per-track on the command line. Next, cfdisk tries to read the current partition table from the disk drive. If it is unable to figure out the partition table, an error is displayed and the program exits. This might also be caused by incorrect geometry information and can be overridden on the command line. Another way around this problem is with the -z option. This will ignore the partition table on the disk.
The main display is composed of four sections, from top to bottom: the header, the partitions, the command line, and a warning line. The header contains the program name and version number followed by the disk drive and its geometry. The partitions section always displays the current partition table. The command line is the place where commands and text are entered. The available commands are usually displayed in brackets. The warning line is usually empty except when there is important information to be displayed. The current partition is highlighted with reverse video (or an arrow if the -a option is given). All partition-specific commands apply to the current partition.
The format of the partition table in the partition's section is, from left to right: Name, Flags, Partition Type, Filesystem Type, and Size. The name is the partition device name. The flags can be Boot, which designates a bootable partition or NC, which stands for "Not Compatible with DOS or OS/2." DOS, OS/2, and possibly other operating systems require the first sector of the first partition on the disk and all logical partitions to begin on the second head. This wastes the second through the last sector of the first track of the first head (the first sector is taken by the partition table itself). cfdisk allows you to recover these "lost" sectors with the maximize command (m). Note that fdisk(8) and some early versions of DOS create all partitions with the number of sectors already maximized. For more information, see the maximize command later in this chapter. The partition type can be Primary or Logical. For unallocated space on the drive, the partition type can also be Pri/Log or empty (if the space is unusable). The filesystem type section displays the name of the filesystem used on the partition, if known. If it is unknown, then Unknown and the hex value of the filesystem type are displayed. A special case occurs when there are sections of the disk drive that cannot be used (because all the primary partitions are used). When this is detected, the filesystem type is displayed as Unusable. The size field displays the size of the partition in megabytes (by default). It can also display the size in sectors and cylinders (see the change units command later in this chapter). If an asterisks (*) appears after the size, this means that the partition is not aligned on cylinder boundaries.
DOS 6.X WARNING
The DOS 6.x FORMAT command looks for some information in the first sector of the data area of the partition and treats this information as more reliable than the information in the partition table. DOS FORMAT expects DOS FDISK to clear the first 512 bytes of the data area of a partition whenever a size change occurs. DOS FORMAT looks at this extra information even if the /U flag is given; we consider this a bug in DOS FORMAT and DOS FDISK.
The bottom line is that if you use cfdisk or fdisk to change the size of a DOS partition table entry and then you must also use dd to zero the first 512 bytes of that partition before using DOS FORMAT to format the partition. For example, if you were using cfdisk to make a DOS partition table entry for /dev/hda1, then (after exiting fdisk or cfdisk and rebooting Linux so that the partition table information is valid), you use the command dd if=/dev/zero of=/dev/hda1 bs=512 count=1 to zero the first 512 bytes of the partition.
Be extremely careful if you use the dd command because a small typo can make all of the data on your disk useless.
For best results, you should always use an OS-specific partition table program. For example, you should make DOS partitions with the DOS FDISK program and Linux partitions with the Linux fdisk or Linux cfdisk program.