1FDISK(8)                     System Administration                    FDISK(8)
2
3
4

NAME

6       fdisk - manipulate disk partition table
7
8

SYNOPSIS

10       fdisk [options] device
11
12       fdisk -l [device...]
13
14

DESCRIPTION

16       fdisk  is a dialog-driven program for creation and manipulation of par‐
17       tition tables.  It understands GPT, MBR, Sun,  SGI  and  BSD  partition
18       tables.
19
20       Block devices can be divided into one or more logical disks called par‐
21       titions.  This division is recorded in  the  partition  table,  usually
22       found in sector 0 of the disk.  (In the BSD world one talks about `disk
23       slices' and a `disklabel'.)
24
25       All partitioning is driven by  device  I/O  limits  (the  topology)  by
26       default.   fdisk  is  able  to optimize the disk layout for a 4K-sector
27       size and use an alignment offset on modern devices for MBR and GPT.  It
28       is  always a good idea to follow fdisk's defaults as the default values
29       (e.g. first and last partition sectors) and partition  sizes  specified
30       by  the  +<size>{M,G,...}  notation are always aligned according to the
31       device properties.
32
33       Note that partx(8) provides a rich interface for scripts to print  disk
34       layouts,  fdisk  is mostly designed for humans.  Backward compatibility
35       in the output of fdisk is not guaranteed.   The  input  (the  commands)
36       should always be backward compatible.
37
38

OPTIONS

40       -b, --sector-size sectorsize
41              Specify  the  sector  size  of  the disk.  Valid values are 512,
42              1024, 2048, and 4096.  (Recent kernels  know  the  sector  size.
43              Use  this option only on old kernels or to override the kernel's
44              ideas.)  Since  util-linux-2.17,  fdisk  differentiates  between
45              logical and physical sector size.  This option changes both sec‐
46              tor sizes to sectorsize.
47
48       -B, --protect-boot
49              Don't erase the begin of the first disk sector when create a new
50              disk label.  This feature is supported for GPT and MBR.
51
52       -c, --compatibility[=mode]
53              Specify  the compatibility mode, 'dos' or 'nondos'.  The default
54              is non-DOS mode.  For backward compatibility, it is possible  to
55              use  the option without the mode argument -- then the default is
56              used.  Note that the optional mode argument cannot be  separated
57              from  the  -c option by a space, the correct form is for example
58              '-c=dos'.
59
60       -h, --help
61              Display a help text and exit.
62
63       -L, --color[=when]
64              Colorize the output.  The optional argument when  can  be  auto,
65              never  or  always.  If the when argument is omitted, it defaults
66              to auto.  The colors can be disabled; for the  current  built-in
67              default see the --help output.  See also the COLORS section.
68
69       -l, --list
70              List  the  partition  tables  for the specified devices and then
71              exit.  If no devices are given, those mentioned in  /proc/parti‐
72              tions (if that file exists) are used.
73
74       -o, --output list
75              Specify which output columns to print.  Use --help to get a list
76              of all supported columns.
77
78              The default list of columns may be extended if list is specified
79              in the format +list (e.g. -o +UUID).
80
81       -s, --getsz
82              Print  the  size in 512-byte sectors of each given block device.
83              This option is DEPRECATED in favour of blockdev(1).
84
85       -t, --type type
86              Enable support only for disklabels of the  specified  type,  and
87              disable support for all other types.
88
89       -u, --units[=unit]
90              When  listing  partition  tables,  show sizes in 'sectors' or in
91              'cylinders'.  The default is to  show  sizes  in  sectors.   For
92              backward compatibility, it is possible to use the option without
93              the unit argument -- then the default is used.   Note  that  the
94              optional unit argument cannot be separated from the -u option by
95              a space, the correct form is for example '-u=cylinders'.
96
97
98       -C, --cylinders number
99              Specify the number of cylinders of the disk.  I have no idea why
100              anybody would want to do so.
101
102       -H, --heads number
103              Specify the number of heads of the disk.  (Not the physical num‐
104              ber, of course, but the number used for partition tables.)  Rea‐
105              sonable values are 255 and 16.
106
107       -S, --sectors number
108              Specify  the  number of sectors per track of the disk.  (Not the
109              physical number, of course, but the number  used  for  partition
110              tables.) A reasonable value is 63.
111
112
113       -w, --wipe when
114              Wipe  filesystem,  RAID  and partition-table signatures from the
115              device, in order to avoid  possible  collisions.   The  argument
116              when  can  be  auto,  never  or always.  When this option is not
117              given, the default is auto, in which case signatures  are  wiped
118              only when in interactive mode.  In all cases detected signatures
119              are reported by warning messages before a new partition table is
120              created.  See also wipefs(8) command.
121
122
123       -W, --wipe-partition when
124              Wipe  filesystem,  RAID  and  partition-table  signatures from a
125              newly created partitions, in order to avoid possible collisions.
126              The  argument  when  can  be  auto,  never or always.  When this
127              option is not given, the default is auto, in which  case  signa‐
128              tures  are wiped only when in interactive mode and after confir‐
129              mation by user.  In all cases detected signatures  are  reported
130              by warning messages before a new partition is created.  See also
131              wipefs(8) command.
132
133
134       -V, --version
135              Display version information and exit.
136
137

DEVICES

139       The device is usually /dev/sda, /dev/sdb or so.  A device  name  refers
140       to  the entire disk.  Old systems without libata (a library used inside
141       the Linux kernel to support ATA host controllers and  devices)  make  a
142       difference  between  IDE and SCSI disks.  In such cases the device name
143       will be /dev/hd* (IDE) or /dev/sd* (SCSI).
144
145       The partition is a device name followed by  a  partition  number.   For
146       example, /dev/sda1 is the first partition on the first hard disk in the
147       system.   See  also  Linux   kernel   documentation   (the   Documenta‐
148       tion/devices.txt file).
149
150

SIZES

152       The  "last sector" dialog accepts partition size specified by number of
153       sectors or by +<size>{K,B,M,G,...} notation.
154
155       If the size is prefixed by  '+' then it is interpreted as  relative  to
156       the  partition first sector. In this case the size is expected in bytes
157       and the number may be followed by the multiplicative suffixes KiB=1024,
158       MiB=1024*1024,  and so on for GiB, TiB, PiB, EiB, ZiB and YiB. The "iB"
159       is optional, e.g. "K" has the same meaning as "KiB".
160
161       The relative sizes are always aligned according to device  I/O  limits.
162       The +<size>{K,B,M,G,...} notation is recommended.
163
164       For  backward  compatibility  fdisk  also accepts the suffixes KB=1000,
165       MB=1000*1000, and so on for GB, TB, PB, EB, ZB and YB. These 10^N  suf‐
166       fixes are deprecated.
167
168

SCRIPT FILES

170       fdisk  allows  to read (by 'I' command) sfdisk compatible script files.
171       The script is applied to in-memory partition table, and then it is pos‐
172       sible to modify the partition table before you write it to the device.
173
174       And  vice-versa it is possible to write the current in-memory disk lay‐
175       out to the script file by command 'O'.
176
177       The script files are  compatible  between  cfdisk,  sfdisk,  fdisk  and
178       another libfdisk applications. For more details see sfdisk(8).
179
180

DISK LABELS

182       GPT (GUID Partition Table)
183              GPT  is  modern  standard for the layout of the partition table.
184              GPT uses 64-bit logical block addresses,  checksums,  UUIDs  and
185              names  for  partitions  and  an  unlimited  number of partitions
186              (although the number of partitions is usually restricted to  128
187              in many partitioning tools).
188
189              Note  that  the  first sector is still reserved for a protective
190              MBR in the GPT specification.  It prevents MBR-only partitioning
191              tools from mis-recognizing and overwriting GPT disks.
192
193              GPT  is  always  a  better choice than MBR, especially on modern
194              hardware with a UEFI boot loader.
195
196       DOS-type (MBR)
197              A DOS-type partition table can describe an unlimited  number  of
198              partitions.   In sector 0 there is room for the description of 4
199              partitions (called `primary').  One of these may be an  extended
200              partition;  this  is  a  box  holding  logical  partitions, with
201              descriptors found in a linked list of  sectors,  each  preceding
202              the  corresponding  logical partitions.  The four primary parti‐
203              tions, present or not, get numbers 1-4.  Logical partitions  are
204              numbered starting from 5.
205
206              In  a  DOS-type partition table the starting offset and the size
207              of each partition is stored in two ways: as an  absolute  number
208              of  sectors (given in 32 bits), and as a Cylinders/Heads/Sectors
209              triple (given in  10+8+6  bits).   The  former  is  OK  --  with
210              512-byte  sectors this will work up to 2 TB.  The latter has two
211              problems.  First, these C/H/S fields can be filled only when the
212              number  of  heads and the number of sectors per track are known.
213              And second, even if we know what these numbers should be, the 24
214              bits  that  are  available do not suffice.  DOS uses C/H/S only,
215              Windows uses both, Linux never uses C/H/S.  The C/H/S addressing
216              is  deprecated  and  may be unsupported in some later fdisk ver‐
217              sion.
218
219              Please, read the DOS-mode section  if  you  want  DOS-compatible
220              partitions.   fdisk  does  not care about cylinder boundaries by
221              default.
222
223       BSD/Sun-type
224              A BSD/Sun disklabel can describe  8  partitions,  the  third  of
225              which should be a `whole disk' partition.  Do not start a parti‐
226              tion that actually uses its first sector (like a swap partition)
227              at cylinder 0, since that will destroy the disklabel.  Note that
228              a BSD label is usually nested within a DOS partition.
229
230       IRIX/SGI-type
231              An IRIX/SGI disklabel can describe 16 partitions,  the  eleventh
232              of which should be an entire `volume' partition, while the ninth
233              should be labeled `volume header'.  The volume header will  also
234              cover  the  partition  table,  i.e., it starts at block zero and
235              extends by default over five cylinders.  The remaining space  in
236              the  volume  header may be used by header directory entries.  No
237              partitions may overlap with the  volume  header.   Also  do  not
238              change  its  type  or make some filesystem on it, since you will
239              lose the partition table.  Use this  type  of  label  only  when
240              working  with Linux on IRIX/SGI machines or IRIX/SGI disks under
241              Linux.
242
243       A sync() and an ioctl(BLKRRPART) (rereading the  partition  table  from
244       disk)  are  performed  before exiting when the partition table has been
245       updated.
246
247

DOS mode and DOS 6.x WARNING

249       Note that all this is deprecated. You don't have to care  about  things
250       like  geometry and cylinders on modern operating systems. If you really
251       want DOS-compatible partitioning then you have to enable DOS  mode  and
252       cylinder  units  by  using the '-c=dos -u=cylinders' fdisk command-line
253       options.
254
255       The DOS 6.x FORMAT command looks for some information in the first sec‐
256       tor  of  the data area of the partition, and treats this information as
257       more reliable than the information in the partition table.  DOS  FORMAT
258       expects  DOS  FDISK  to clear the first 512 bytes of the data area of a
259       partition whenever a size change occurs.  DOS FORMAT will look at  this
260       extra  information  even  if the /U flag is given -- we consider this a
261       bug in DOS FORMAT and DOS FDISK.
262
263       The bottom line is that if you use fdisk or cfdisk to change  the  size
264       of  a  DOS  partition table entry, then you must also use dd(1) to zero
265       the first 512 bytes of that partition before using DOS FORMAT to format
266       the partition.  For example, if you were using fdisk to make a DOS par‐
267       tition table entry for /dev/sda1, then (after exiting fdisk and reboot‐
268       ing  Linux  so that the partition table information is valid) you would
269       use the command "dd if=/dev/zero of=/dev/sda1 bs=512 count=1"  to  zero
270       the first 512 bytes of the partition.
271
272       fdisk  usually  obtains  the  disk geometry automatically.  This is not
273       necessarily the physical disk geometry (indeed,  modern  disks  do  not
274       really  have anything like a physical geometry, certainly not something
275       that can be described in the simplistic Cylinders/Heads/Sectors  form),
276       but it is the disk geometry that MS-DOS uses for the partition table.
277
278       Usually all goes well by default, and there are no problems if Linux is
279       the only system on the disk.  However, if the disk  has  to  be  shared
280       with  other  operating systems, it is often a good idea to let an fdisk
281       from another operating system make at least one partition.  When  Linux
282       boots  it looks at the partition table, and tries to deduce what (fake)
283       geometry is required for good cooperation with other systems.
284
285       Whenever a partition table is printed out in DOS  mode,  a  consistency
286       check is performed on the partition table entries.  This check verifies
287       that the physical and logical start and end points are  identical,  and
288       that  each partition starts and ends on a cylinder boundary (except for
289       the first partition).
290
291       Some versions of MS-DOS create a first partition which does  not  begin
292       on  a cylinder boundary, but on sector 2 of the first cylinder.  Parti‐
293       tions beginning in cylinder 1 cannot begin on a cylinder boundary,  but
294       this  is  unlikely  to  cause  difficulty  unless you have OS/2 on your
295       machine.
296
297       For best results, you should always use an OS-specific partition  table
298       program.   For  example,  you  should  make DOS partitions with the DOS
299       FDISK program and Linux partitions with the Linux fdisk or Linux cfdisk
300       programs.
301

COLORS

303       Implicit  coloring  can be disabled by an empty file /etc/terminal-col‐
304       ors.d/fdisk.disable.
305
306       See terminal-colors.d(5) for more details about colorization configura‐
307       tion. The logical color names supported by fdisk are:
308
309       header The header of the output tables.
310
311       help-title
312              The help section titles.
313
314       warn   The warning messages.
315
316       welcome
317              The welcome message.
318
319

AUTHORS

321       Karel Zak ⟨kzak@redhat.com⟩
322       Davidlohr Bueso ⟨dave@gnu.org⟩
323
324       The  original version was written by Andries E. Brouwer, A. V. Le Blanc
325       and others.
326
327

ENVIRONMENT

329       FDISK_DEBUG=all
330              enables fdisk debug output.
331
332       LIBFDISK_DEBUG=all
333              enables libfdisk debug output.
334
335       LIBBLKID_DEBUG=all
336              enables libblkid debug output.
337
338       LIBSMARTCOLS_DEBUG=all
339              enables libsmartcols debug output.
340
341       LIBSMARTCOLS_DEBUG_PADDING=on
342              use  visible  padding  characters.  Requires  enabled  LIBSMART‐
343              COLS_DEBUG.
344
345

SEE ALSO

347       cfdisk(8), mkfs(8), partx(8), sfdisk(8)
348
349

AVAILABILITY

351       The  fdisk  command  is part of the util-linux package and is available
352       from https://www.kernel.org/pub/linux/utils/util-linux/.
353
354
355
356util-linux                       February 2016                        FDISK(8)
Impressum