summaryrefslogtreecommitdiffstats
path: root/disk-utils/fdisk.8
diff options
context:
space:
mode:
Diffstat (limited to 'disk-utils/fdisk.8')
-rw-r--r--disk-utils/fdisk.8221
1 files changed, 134 insertions, 87 deletions
diff --git a/disk-utils/fdisk.8 b/disk-utils/fdisk.8
index 29d56c40b..576bce2ec 100644
--- a/disk-utils/fdisk.8
+++ b/disk-utils/fdisk.8
@@ -1,20 +1,50 @@
.\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu)
+.\" Copyright 1998 Andries E. Brouwer (aeb@cwi.nl)
.\" May be distributed under the GNU General Public License
-.TH FDISK 8 "3 June 1995" "Linux 1.0" "Linux Programmer's Manual"
+.TH FDISK 8 "11 June 1998" "Linux 2.0" "Linux Programmer's Manual"
.SH NAME
fdisk \- Partition table manipulator for Linux
.SH SYNOPSIS
-.B fdisk
-.B "[ \-l ] [ \-v ] [ \-s partition] ["
-device
-.B ]
+.BI "fdisk [\-b] [\-u] [" device ]
+.sp
+.BI "fdisk \-l [\-b] [\-u] [" "device ..." ]
+.sp
+.BI "fdisk \-s " "partition ..."
+.sp
+.BI "fdisk \-v
.SH DESCRIPTION
+Hard disks can be divided into one or more logical disks called
+.IR partitions .
+This division is described in the
+.I "partition table"
+found in sector 0 of the disk.
+
+In the BSD world one talks about `disk slices' and a `disklabel'.
+
+Linux needs at least one partition, namely for its root file system.
+It can use swap files and/or swap partitions, but the latter are more
+efficient. So, usually one will want a second Linux partition
+dedicated as swap partition.
+On Intel compatible hardware, the BIOS that boots the system
+can often only access the first 1024 cylinders of the disk.
+For this reason people with large disks often create a third partition,
+just a few MB large, typically mounted on
+.IR /boot ,
+to store the kernel image and a few auxiliary files needed at boot time,
+so as to make sure that this stuff is accessible to the BIOS.
+There may be reasons of security, ease of administration and backup,
+or testing, to use more than the minimum number of partitions.
+
.B fdisk
-is a menu driven program for manipulation of the hard disk partition table.
+(in the first form of invocation)
+is a menu driven program for creation and manipulation of
+partition tables.
+It understands DOS type partition tables and BSD or SUN type disklabels.
+
The
.I device
is usually one of the following:
-.sp
+.br
.nf
.RS
/dev/hda
@@ -23,54 +53,79 @@ is usually one of the following:
/dev/sdb
.RE
.fi
+(/dev/hd[a-h] for IDE disks, /dev/sd[a-p] for SCSI disks,
+/dev/ed[a-d] for ESDI disks, /dev/xd[ab] for XT disks).
+A device name refers to the entire disk.
+
The
.I partition
is a
.I device
name followed by a partition number. For example,
.B /dev/hda1
-is the first partition on the first hard disk in the system.
+is the first partition on the first IDE hard disk in the system.
+IDE disks can have up to 63 partitions, SCSI disks up to 15.
+See also
+.IR /usr/src/linux/Documentation/devices.txt .
+
+A BSD/SUN type disklabel can describe 8 partitions,
+the third of which should be a `whole disk' partition.
+Do not start a partition that actually uses its first sector
+(like a swap partition) at cylinder 0, since that will
+destroy the disklabel.
+
+A DOS type partition table can describe an unlimited number
+of partitions. In sector 0 there is room for the description
+of 4 partitions (called `primary'). One of these may be an
+extended partition; this is a box holding logical partitions,
+with descriptors found in a linked list of sectors, each
+preceding the corresponding logical partitions.
+The four primary partitions, present or not, get numbers 1-4.
+Logical partitions start numbering from 5.
+
+In a DOS type partition table the starting offset and the size
+of each partition is stored in two ways: as an absolute number
+of sectors (given in 32 bits) and as a Cylinders/Heads/Sectors
+triple (given in 10+8+6 bits). The former is OK - with 512-byte
+sectors this will work up to 2 TB. The latter has two different
+problems. First of all, these C/H/S fields can be filled only
+when the number of heads and the number of sectors per track
+are known. Secondly, even if we know what these numbers should be,
+the 24 bits that are available do not suffice.
+DOS uses C/H/S only, Windows uses both, Linux never uses C/H/S.
If possible,
.B fdisk
-will obtain the disk geometry automatically. This is
-.I not
-necessarily the
-.I physical
-disk geometry, but is the disk geometry that MS-DOS uses for the partition
-table. If
-.B fdisk
-warns you that you need to set the disk geometry, please believe this
-statement, and set the geometry. This should only be necessary with
-certain SCSI host adapters (the drivers for which are rapidly being
-modified to provide geometry information automatically).
+will obtain the disk geometry automatically. This is not
+necessarily the physical disk geometry (indeed, modern disks do not
+really have anything like a physical geometry, certainly not something
+that can be described in simplistic Cylinders/Heads/Sectors form),
+but is the disk geometry that MS-DOS uses for the partition table.
+
+Usually all goes well by default, and there are no problems if
+Linux is the only system on the disk. However, if the disk has
+to be shared with other operating systems, it is often a good idea
+to let an fdisk from another operating system make at least one
+partition. When Linux boots it looks at the partition table, and
+tries to deduce what (fake) geometry is required for good
+cooperation with other systems.
Whenever a partition table is printed out, a consistency check is performed
on the partition table entries. This check verifies that the physical and
logical start and end points are identical, and that the partition starts
and ends on a cylinder boundary (except for the first partition).
-Old versions of fdisk (all versions prior to 1.1r [including 0.93])
-incorrectly mapped the cylinder/head/sector specification onto absolute
-sectors. This may result in the first partition on a drive failing the
-consistency check. If you use LILO to boot, this situation can be ignored.
-However, there are reports that the OS/2 boot manager will not boot a
-partition with inconsistent data.
-
Some versions of MS-DOS create a first partition which does not begin
on a cylinder boundary, but on sector 2 of the first cylinder.
Partitions beginning in cylinder 1 cannot begin on a cylinder boundary, but
this is unlikely to cause difficulty unless you have OS/2 on your machine.
-In version 1.1r, a BLKRRPART ioctl() is performed before exiting when the
-partition table is updated. This is primarily to ensure that removable
-SCSI disks have their partition table information updated. If the kernel
-does not update its partition table information, fdisk warns you to
-reboot. If you do not reboot your system after receiving such a warning,
-you may lose or corrupt the data on the disk. Sometimes BLKRRPART fails
-silently, when installing Linux, you should
-.I always
-reboot after editing the partition table.
+A sync() and a BLKRRPART ioctl() (reread partition table from disk)
+are performed before exiting when the partition table has been updated.
+Long ago it used to be necessary to reboot after the use of fdisk.
+I do not think this is the case anymore - indeed, rebooting too quickly
+might cause loss of not-yet-written data. Note that both the kernel
+and the disk hardware may buffer data.
.SH "DOS 6.x WARNING"
@@ -91,10 +146,6 @@ partition table entry for /dev/hda1, then (after exiting fdisk or cfdisk
and rebooting Linux so that the partition table information is valid) you
would use the command "dd if=/dev/zero of=/dev/hda1 bs=512 count=1" to zero
the first 512 bytes of the partition.
-.B BE EXTREMELY CAREFUL
-if you use the
-.B dd
-command, since a small typo can make all of the data on your disk useless.
.B BE EXTREMELY CAREFUL
if you use the
@@ -108,59 +159,55 @@ program and Linux partitions with the Linux fdisk or Linux cfdisk program.
.SH OPTIONS
.TP
.B \-v
-Prints version number of
+Print version number of
.B fdisk
-program.
+program and exit.
.TP
.B \-l
-Lists the partition tables for
-.BR /dev/hda ,
-.BR /dev/hdb ,
-.BR /dev/sda ,
-.BR /dev/sdb ,
-.BR /dev/sdc ,
-.BR /dev/sdd ,
-.BR /dev/sde ,
-.BR /dev/sdf ,
-.BR /dev/sdg ,
-.BR /dev/sdh ,
-and then exits.
+List the partition tables for
+.BR /dev/hd[a-d] ,
+.BR /dev/sd[a-h] ,
+.BR /dev/ed[a-d] ,
+and then exit.
.TP
-.BI \-s partition
-If the
-.I partition
-is not a DOS partition (i.e., the partition id is greater than 10), then
-the
+.B \-b
+When listing partition tables, also output a `Begin' column,
+as earlier versions of fdisk did by default.
+(Note: the values in this column, when given in cylinder units,
+cannot be larger than 1023. There is nothing wrong if Begin and Start
+differ, at least not as far as Linux is concerned.)
+.TP
+.B \-u
+When listing partition tables, give sizes in sectors instead
+of cylinders.
+.TP
+.BI "\-s " partition
+The
.I size
-of that partition is printed on the standard output. This value is
-normally used as an argument to the
+of the partition (in blocks) is printed on the standard output.
+This value is normally used as an argument to the
.BR mkfs (8)
program to specify the size of the partition which will be formatted.
-.SH BUGS
-Although this man page (written by faith@cs.unc.edu) is poor, there is
-.I excellent
-documentation in the README.fdisk file (written by LeBlanc@mcc.ac.uk) that
-should always be with the fdisk distribution. If you cannot find this file
-in the
-.I util-linux-*
-directory or with the
-.I fdisk.c
-source file, then you should write to the distributor of your version of
+(Older versions of fdisk would do this only if the partition id is
+greater than 10, in an attempt to refuse DOS partitions;
+this test has been deleted.)
+Note that
+.B "sfdisk -s"
+gives different (namely, correct) answers.
+Reasons for the difference are that the kernel and
.B fdisk
-and complain that you do not have all of the available documentation.
-.SH AUTHOR
-A. V. Le Blanc (LeBlanc@mcc.ac.uk)
-.br
-v1.0r: SCSI and extfs support added by Rik Faith (faith@cs.unc.edu)
-.br
-v1.1r: Bug fixes and enhancements by Rik Faith (faith@cs.unc.edu), with
-special thanks to Michael Bischoff (i1041905@ws.rz.tu-bs.de or
-mbi@mo.math.nat.tu-bs.de).
-.br
-v1.3: Latest enhancements and bug fixes by A. V. Le Blanc, including the
-addition of the
-.B \-s
-option.
-.bt
-v2.0: Disks larger than 2GB are now fully supported, thanks to Remy Card's
-llseek support.
+need not have the same idea about partition numbering
+(e.g., in case you have BSD slices), and have different
+ideas about the size of an extended partition.
+.SH BUGS
+There are several *fdisk programs around.
+Each has its problems and strengths.
+Try them in the order
+.BR cfdisk ,
+.BR fdisk ,
+.BR sfdisk .
+.\" .SH AUTHORS
+.\" A. V. Le Blanc (LeBlanc@mcc.ac.uk)
+.\" Bernhard Fastenrath (fasten@informatik.uni-bonn.de)
+.\" Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+.\" and many others.