32
(in the first form of invocation)
33
is a menu-driven program for creation and manipulation of
35
It understands DOS-type partition tables and BSD- or SUN-type disklabels.
38
does not understand GUID partition tables (GPTs) and it is not designed
39
for large partitions. In these cases, use the more advanced GNU
43
does not use DOS-compatible mode and cylinders as display units by default.
44
The old deprecated DOS behavior can be enabled with
45
the '-c=dos -u=cylinders' command-line options.
31
47
Hard disks can be divided into one or more logical disks called
33
This division is described in the
49
This division is recorded in the
50
.IR "partition table" ,
35
51
found in sector 0 of the disk.
37
In the BSD world one talks about `disk slices' and a `disklabel'.
52
(In the BSD world one talks about `disk slices' and a `disklabel'.)
39
54
Linux needs at least one partition, namely for its root file system.
40
55
It can use swap files and/or swap partitions, but the latter are more
41
efficient. So, usually one will want a second Linux partition
56
efficient. So, usually one will want a second Linux partition
42
57
dedicated as swap partition.
43
On Intel compatible hardware, the BIOS that boots the system
58
On Intel-compatible hardware, the BIOS that boots the system
44
59
can often only access the first 1024 cylinders of the disk.
45
60
For this reason people with large disks often create a third partition,
46
61
just a few MB large, typically mounted on
50
65
There may be reasons of security, ease of administration and backup,
51
66
or testing, to use more than the minimum number of partitions.
54
(in the first form of invocation)
55
is a menu driven program for creation and manipulation of
57
It understands DOS type partition tables and BSD or SUN type disklabels.
60
doesn't understand GUID Partition Table (GPT) and
61
it is not designed for large partitions. In particular case use more advanced GNU
66
is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk.
67
The old systems without libata (a library used inside the Linux kernel to
71
is usually /dev/sda, /dev/sdb or so. A device name refers to the entire disk.
72
Old systems without libata (a library used inside the Linux kernel to
68
73
support ATA host controllers and devices) make a difference between IDE and
69
SCSI disks. In such a case the device name will be /dev/hd* (IDE) or /dev/sd*
74
SCSI disks. In such cases the device name will be /dev/hd* (IDE) or /dev/sd*
76
name followed by a partition number. For example,
79
is a device name followed by a partition number. For example, /dev/sda1
78
80
is the first partition on the first hard disk in the system.
79
81
See also Linux kernel documentation (the Documentation/devices.txt file).
81
A BSD/SUN type disklabel can describe 8 partitions,
84
A BSD/SUN-type disklabel can describe 8 partitions,
82
85
the third of which should be a `whole disk' partition.
83
86
Do not start a partition that actually uses its first sector
84
87
(like a swap partition) at cylinder 0, since that will
85
88
destroy the disklabel.
87
An IRIX/SGI type disklabel can describe 16 partitions,
90
An IRIX/SGI-type disklabel can describe 16 partitions,
88
91
the eleventh of which should be an entire `volume' partition,
89
92
while the ninth should be labeled `volume header'.
90
93
The volume header will also cover the partition table, i.e.,
91
94
it starts at block zero and extends by default over five cylinders.
92
95
The remaining space in the volume header may be used by header
93
96
directory entries. No partitions may overlap with the volume header.
94
Also do not change its type and make some file system on it, since
97
Also do not change its type or make some filesystem on it, since
95
98
you will lose the partition table. Use this type of label only when
96
99
working with Linux on IRIX/SGI machines or IRIX/SGI disks under Linux.
98
A DOS type partition table can describe an unlimited number
99
of partitions. In sector 0 there is room for the description
100
of 4 partitions (called `primary'). One of these may be an
101
A DOS-type partition table can describe an unlimited number
102
of partitions. In sector 0 there is room for the description
103
of 4 partitions (called `primary'). One of these may be an
101
104
extended partition; this is a box holding logical partitions,
102
105
with descriptors found in a linked list of sectors, each
103
106
preceding the corresponding logical partitions.
104
107
The four primary partitions, present or not, get numbers 1-4.
105
108
Logical partitions start numbering from 5.
107
In a DOS type partition table the starting offset and the size
110
In a DOS-type partition table the starting offset and the size
108
111
of each partition is stored in two ways: as an absolute number
109
of sectors (given in 32 bits) and as a Cylinders/Heads/Sectors
110
triple (given in 10+8+6 bits). The former is OK - with 512-byte
111
sectors this will work up to 2 TB. The latter has two different
112
problems. First of all, these C/H/S fields can be filled only
112
of sectors (given in 32 bits), and as a Cylinders/Heads/Sectors
113
triple (given in 10+8+6 bits). The former is OK -- with 512-byte
114
sectors this will work up to 2 TB. The latter has two
115
problems. First, these C/H/S fields can be filled only
113
116
when the number of heads and the number of sectors per track
114
are known. Secondly, even if we know what these numbers should be,
117
are known. And second, even if we know what these numbers should be,
115
118
the 24 bits that are available do not suffice.
116
119
DOS uses C/H/S only, Windows uses both, Linux never uses C/H/S.
121
124
necessarily the physical disk geometry (indeed, modern disks do not
122
125
really have anything like a physical geometry, certainly not something
123
126
that can be described in simplistic Cylinders/Heads/Sectors form),
124
but is the disk geometry that MS-DOS uses for the partition table.
127
but it is the disk geometry that MS-DOS uses for the partition table.
126
129
Usually all goes well by default, and there are no problems if
127
Linux is the only system on the disk. However, if the disk has
130
Linux is the only system on the disk. However, if the disk has
128
131
to be shared with other operating systems, it is often a good idea
129
132
to let an fdisk from another operating system make at least one
130
partition. When Linux boots it looks at the partition table, and
133
partition. When Linux boots it looks at the partition table, and
131
134
tries to deduce what (fake) geometry is required for good
132
135
cooperation with other systems.
134
137
Whenever a partition table is printed out, a consistency check is performed
135
138
on the partition table entries. This check verifies that the physical and
136
logical start and end points are identical, and that the partition starts
139
logical start and end points are identical, and that each partition starts
137
140
and ends on a cylinder boundary (except for the first partition).
139
142
Some versions of MS-DOS create a first partition which does not begin
141
144
Partitions beginning in cylinder 1 cannot begin on a cylinder boundary, but
142
145
this is unlikely to cause difficulty unless you have OS/2 on your machine.
144
A sync() and a BLKRRPART ioctl() (reread partition table from disk)
147
A sync() and an ioctl(BLKRRPART) (reread partition table from disk)
145
148
are performed before exiting when the partition table has been updated.
146
149
Long ago it used to be necessary to reboot after the use of fdisk.
147
I do not think this is the case anymore - indeed, rebooting too quickly
148
might cause loss of not-yet-written data. Note that both the kernel
150
I do not think this is the case anymore -- indeed, rebooting too quickly
151
might cause loss of not-yet-written data. Note that both the kernel
149
152
and the disk hardware may buffer data.
151
154
.SH "DOS 6.x WARNING"
182
185
.BI "\-b " sectorsize
183
Specify the sector size of the disk. Valid values are 512, 1024, 2048 or 4096.
184
(Recent kernels know the sector size. Use this only on old kernels or
185
to override the kernel's ideas.) Since util-linux-ng 2.17 fdisk differentiates
186
between logical and physical sector size. This option changes both sector sizes to
186
Specify the sector size of the disk. Valid values are 512, 1024, 2048 or 4096.
187
(Recent kernels know the sector size. Use this only on old kernels or
188
to override the kernel's ideas.) Since util-linux-2.17, fdisk differentiates
189
between logical and physical sector size. This option changes both sector sizes to
190
Print help and then exit.
193
Switch off DOS-compatible mode. (Recommended)
193
Specify the compatiblity mode, 'dos' or 'nondos'. The default is non-DOS
194
mode. For backward compatibility, it is possible to use the option without
195
the <mode> argument -- then the default is used. Note that the optional
196
<mode> argument cannot be separated from the -c option by a space, the correct
197
form is for example '-c=dos'.
196
200
Specify the number of cylinders of the disk.
197
201
I have no idea why anybody would want to do so.
200
Specify the number of heads of the disk. (Not the physical number,
204
Specify the number of heads of the disk. (Not the physical number,
201
205
of course, but the number used for partition tables.)
202
206
Reasonable values are 255 and 16.
207
211
partition tables.)
208
212
A reasonable value is 63.
215
Print help and then exit.
211
218
List the partition tables for the specified devices and then exit.
212
219
If no devices are given, those mentioned in
213
220
.I /proc/partitions
214
221
(if that exists) are used.
217
When listing partition tables, give sizes in sectors instead
223
.BI "\-s " partition...
224
Print the size (in blocks) of each given partition.
223
of the partition (in blocks) is printed on the standard output.
227
When listing partition tables, show sizes in 'sectors' or in 'cylinders'. The
228
default is to show sizes in sectors. For backward compatibility, it is possible
229
to use the option without the <units> argument -- then the default is used.
230
Note that the optional <unit> argument cannot be separated from the -u option
231
by a space, the correct form is for example '-u=cylinders'.
226
234
Print version number of
238
246
is a beautiful program that has strict requirements on
239
247
the partition tables it accepts, and produces high quality partition
240
tables. Use it if you can.
248
tables. Use it if you can.
242
250
is a buggy program that does fuzzy things - usually it happens to
243
produce reasonable results. Its single advantage is that it has
251
produce reasonable results. Its single advantage is that it has
244
252
some support for BSD disk labels and other non-DOS partition tables.
245
253
Avoid it if you can.
247
is for hackers only - the user interface is terrible, but it is
255
is for hackers only -- the user interface is terrible, but it is
248
256
more correct than fdisk and more powerful than both fdisk and cfdisk.
249
257
Moreover, it can be used noninteractively.)