from small one page howto to huge articles all in one place

search text in:

Which linux distribution do you use?

poll results

Last additions:
using iotop to find disk usage hogs

using iotop to find disk usage hogs






average rating: 1.7 (82 votes) (1=very good 6=terrible)

May 25th. 2007:




why adblockers are bad

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels

Workaround and fixes for the current Core Dump Handling vulnerability affected kernels






average rating: 1.3 (27 votes) (1=very good 6=terrible)

April, 26th. 2006:

You are here: manpages


Section: System Administration (8)
Updated: December 2014
Index Return to Main Contents


sfdisk - display or manipulate a disk partition table  


sfdisk [options] device [-N partition-number]

sfdisk [options] command  


sfdisk is a script-oriented tool for partitioning any block device.

Since version 2.26 sfdisk supports MBR (DOS), GPT, SUN and SGI disk labels, but no longer provides any functionality for CHS (Cylinder-Head-Sector) addressing. CHS has never been important for Linux, and this addressing concept does not make any sense for new devices.

sfdisk (since version 2.26) aligns start and end of the partitions to block-device I/O limits when relative sizes are specified, or when the default values are used.

sfdisk does not create the standard system partitions for SGI and SUN disk labels like fdisk(8) does. It is necessary to explicitly create all partitions including whole-disk system partitions.



The commands are mutually exclusive.
[-N partition-number] device
The default sfdisk command is to read the specification for the desired partitioning of device from standard input, and then create a partition table according to the specification. See below for the description of the input format. If standard input is a terminal, then sfdisk starts an interactive session.

If the option -N is specified, then the changes are applied to the partition addressed by partition-number.

-a, --activate device [partition-number...]
Switch on the bootable flag. If no partition-number is specified, then all partitions with an enabled flag are listed.
-d, --dump device
Dump the partitions of a device in a format that is usable as input to sfdisk. See the section BACKING UP THE PARTITION TABLE.
-g, --show-geometry [device...]
List the geometry of all or the specified devices.
-l, --list [device...]
List the partitions of all or the specified devices. This command can be used together with --verify.
--part-attrs device partno [attrs]
Change the GPT partition attribute bits. If attrs is not specified, then print the current partition settings. The attrs argument is a comma- or space-delimited list of bits. The currently supported attribute bits are: RequiredPartiton, NoBlockIOProtocol, LegacyBIOSBootable and GUID-specific bits in the range from 48 to 63. For example, the string "RequiredPartiton,50,51" sets three bits.
--part-label device partno [label]
Change the GPT partition name (label). If label is not specified, then print the current partition label.
--part-type device partno [type]
Change the partition type. If type is not specified, then print the current partition type. The type argument is hexadecimal for MBR, or a GUID for GPT. For backward compatibility the options -c and --id have the same meaning.
--part-uuid device partno [uuid]
Change the GPT partition UUID. If uuid is not specified, then print the current partition UUID.
-s, --show-size [device...]
List the sizes of all or the specified devices.
-T, --list-types
Print all supported types for the current disk label or the label specified by --label.
-V, --verify
Test whether the partition table and partitions seem correct.



-A, --append
Don't create a new partition table, but only append the specified partitions.
-b, --backup
Back up the current partition table sectors before starting the partitioning. The default backup file name is ~/sfdisk-<device>-<offset>.bak; to use another name see --backup-file.
Colorize the output. The optional argument when can be auto, never or always. If the when argument is omitted, it defaults to auto. The colors can be disabled, for the current built-in default see --help output. See also the COLORS section.
-f, --force
Disable all consistency checking.
Deprecated and ignored option. Partitioning that is compatible with Linux (and other modern OS) is the default.
-n, --no-act
Do everything except writing to the device.
Do not check through the re-read-partition-table ioctl whether the device is in use.
-O, --backup-file path
Override the default backup file name. Note that the device name and offset are always appended to the file name.
-o, --output list
Specify which output columns to print. Use --help to get a list of all supported columns.

The default list of columns may be extended if list is specified in the format +list (e.g. -o +UUID).

-q, --quiet
Suppress extra info messages.
-u, --unit S
Deprecated option. Only the sector unit is supported.
-X, --label type
Specify the disk label type (e.g. dos, gpt, ...). If this option is not given, then sfdisk defaults to the existing label, but if there is no label on the device yet, then the type defaults to dos.
-Y, --label-nested type
Force editing of a nested disk label. The primary disk label has to exist already. This option allows to edit for example a hybrid/protective MBR on devices with GPT.
-v, --version
Display version information and exit.
-h, --help
Display help text and exit.



sfdisk supports two input formats and generic header lines.

Header lines

The optional header lines specify generic information that apply to the partition table. The header-line format is:

<name>: <value>

The currently recognized headers are:
Specify the partitioning unit. The only supported unit is sectors.
Specify the partition table type. For example dos or gpt.
Specify the partition table identifier. It should be a hexadecimal number (with a 0x prefix) for MBR and a UUID for GPT.

Note that it is only possible to use header lines before the first partition is specified in the input.

Unnamed-fields format

start size type bootable

where each line fills one partition descriptor.

Fields are separated by whitespace, or by comma or semicolon possibly followed by whitespace; initial and trailing whitespace is ignored. Numbers can be octal, decimal or hexadecimal; decimal is the default. When a field is absent or empty, a default value is used. But when the -N option (change a single partition) is given, the default for each field is its previous value.

The default value of start is the first non-assigned sector aligned according to device I/O limits. The default start offset for the first partition is 1 MiB. The offset may be followed by the multiplicative suffixes (KiB, MiB, GiB, TiB, PiB, EiB, ZiB and YiB) then the number is interpreted as offset in bytes.

The default value of size is as much as possible (until the next partition or end-of-device). A '+' can be used instead of a number for size, which also means as much as possible. The size may be followed by the multiplicative suffixes (KiB, MiB, GiB, TiB, PiB, EiB, ZiB and YiB), then the number is interpreted as size of the partition in bytes and then the size is aligned according to the device I/O limits. The default is to interpret the number as number of sectors.

The partition type is given in hex for MBR (DOS), without the 0x prefix, a GUID string for GPT, or a shortcut:

Linux; means 83 for MBR and 0FC63DAF-8483-4772-8E79-3D69D8477DE4 for GPT.
swap area; means 82 for MBR and 0657FD6D-A4AB-43C4-84E5-0933C84B4F4F for GPT
extended partition; means 5 for MBR
home partition; means 933AC7E1-2EB4-4F13-B844-0E14E2AEF915 for GPT
linux extended partition; means 85 for MBR.

bootable is specified as [*|-], with as default not-bootable. (The value of this field is irrelevant for Linux - when Linux runs it has been booted already - but might play a role for certain boot loaders and for other operating systems.)

Named-fields format

This format is more readable, robust, extendible and allows to specify additional information (e.g. a UUID). It is recommended to use this format to keep your scripts more readable.

[device :] name[=value], ...

The device field is optional. sfdiskextracts the partition number from the device name. It allows to specify the partitions in random order. This functionality is mostly used by --dump. Don't use it if you are not sure.

The value can be between quotation marks (e.g. name="This is partition name"). The currently supported fields are:

The first non-assigned sector aligned according to device I/O limits. The default start offset for the first partition is 1 MiB. The offset may be followed by the multiplicative suffixes (KiB, MiB, GiB, TiB, PiB, EiB, ZiB and YiB) then the number is interpreted as offset in bytes.
Specify the partition size in sectors. The number may be followed by the multiplicative suffixes (KiB, MiB, GiB, TiB, PiB, EiB, ZiB and YiB), then it's interpreted as size in bytes and the size is aligned according to device I/O limits.
Mark the partition as bootable.
Partition attributes, usually GPT partition attribute bits. See --part-attrs for more details about the GPT-bits string format.
GPT partition UUID.
GPT partition name.
A hexadecimal number (without 0x) for an MBR partition, or a GUID for a GPT partition. For backward compatibility the Id= field has the same meaning.



It is recommended to save the layout of your devices. sfdisk supports two ways.

Use the --dump option to save a description of the device layout to a text file. The dump format is suitable for later sfdisk input. For example:

sfdisk --dump /dev/sda > sda.dump

This can later be restored by:

sfdisk /dev/sda < sda.dump

If you want to do a full (binary) backup of all sectors where the partition table is stored, then use the --backup option. It writes the sectors to ~/sfdisk-<device>-<offset>.bak files. The default name of the backup file can be changed with the --backup-file option. The backup files contain only raw data from the device. Note that the same concept of backup files is used by wipefs(8). For example:

sfdisk --backup /dev/sda

The GPT header can later be restored by:

dd if=~/sfdisk-sda-0x00000200.bak of=/dev/sda seek=$((0x00000200)) bs=1 conv=notrunc

Note that sfdisk since version 2.26 no longer provides the -I option to restore sectors. dd (1) provides all necessary functionality.



Implicit coloring can be disabled by an empty file /etc/terminal-colors.d/sfdisk.disable.

See terminal-colors.d(5) for more details about colorization configuration. The logical color names supported by sfdisk are:

The header of the output tables.
The warning messages.
The welcome message.



Since version 2.26 sfdisk no longer provides the -R or --re-read option to force the kernel to reread the partition table. Use blockdev --rereadpt instead.

Since version 2.26 sfdisk does not provide the --DOS, --IBM, --DOS-extended, --unhide, --show-extended, --cylinders, --heads, --sectors, --inside-outer, --not-inside-outer options.



enables sfdisk debug output.
enables libfdisk debug output.
enables libblkid debug output.
enables libsmartcols debug output.



fdisk(8), cfdisk(8), parted(8), partprobe(8), partx(8)



Karel Zak <>

The current sfdisk implementation is based on the original sfdisk from Andries E. Brouwer.



The sfdisk command is part of the util-linux package and is available from




Please read "Why adblockers are bad".

Other free services
Shorten long
URLs to short
links like
Reverse DNS lookup
Find out which hostname(s)
resolve to a
given IP or other hostnames for the server
rdf newsfeed | rss newsfeed | Atom newsfeed
- Powered by LeopardCMS - Running on Gentoo -
Copyright 2004-2013 Sascha Nitsch Unternehmensberatung UG(haftungsbeschränkt)
Valid XHTML1.1 : Valid CSS : buttonmaker
- Level Triple-A Conformance to Web Content Accessibility Guidelines 1.0 -
- Copyright and legal notices -
Time to create this page: 3.7 ms