отображать или управлять таблицей разделов диска (display or manipulate a disk partition table)
INPUT FORMATS
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:
unit
Specify the partitioning unit. The only supported unit is
sectors
.
label
Specify the partition table type. For example dos
or gpt
.
label-id
Specify the partition table identifier. It should be a
hexadecimal number (with a 0x prefix) for MBR and a UUID for
GPT.
first-lba
Specify the first usable sector for GPT partitions.
last-lba
Specify the last usable sector for GPT partitions.
table-length
Specify the maximal number of GPT partitions.
grain
Specify minimal size in bytes used to calculate partitions
alignment. The default is 1MiB and it's strongly recommended
to use the default. Do not modify this variable if you're not
sure.
sector-size
Specify sector size. This header is informative only and it
is not used when sfdisk creates a new partition table, in
this case the real device specific value is always used and
sector size from the dump is ignored.
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, 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, empty or specified as '-' 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 indicates "as much as possible"; i.e.,
until the next partition or end-of-device. A numerical argument
is by default interpreted as a number of sectors, however if the
size is followed by one of the multiplicative suffixes (KiB, MiB,
GiB, TiB, PiB, EiB, ZiB and YiB) then the number is interpreted
as the size of the partition in bytes and it is then aligned
according to the device I/O limits. A '+' can be used instead of
a number to enlarge the partition as much as possible. Note '+'
is equivalent to the default behaviour for a new partition;
existing partitions will be resized as required.
The partition type is given in hex for MBR (DOS) where 0x prefix
is optional; a GUID string for GPT; a shortcut or an alias. It's
recommended to use two letters for MBR hex codes to avoid
collision between deprecated shortcut 'E' and '0E' MBR hex code.
For backward compatibility sfdisk
tries to interpret type as a
shortcut as a first possibility in partitioning scripts although
on other places (e.g. --part-type
command) it tries shortcuts as
the last possibility.
Since v2.36 libfdisk supports partition type aliases as extension
to shortcuts. The alias is a simple human readable word (e.g.
"linux").
Since v2.37 libfdisk supports partition type names on input,
ignoring the case of the characters and all non-alphanumeric and
non-digit characters in the name (e.g. "Linux /usr x86" is the
same as "linux usr-x86").
Supported shortcuts and aliases:
L - alias 'linux'
Linux; means 83 for MBR and
0FC63DAF-8483-4772-8E79-3D69D8477DE4 for GPT.
S - alias 'swap'
swap area; means 82 for MBR and
0657FD6D-A4AB-43C4-84E5-0933C84B4F4F for GPT
Ex - alias 'extended'
MBR extended partition; means 05 for MBR. The original
shortcut 'E' is deprecated due to collision with 0x0E MBR
partition type.
H - alias 'home'
home partition; means 933AC7E1-2EB4-4F13-B844-0E14E2AEF915
for GPT
U - alias 'uefi'
EFI System partition, means EF for MBR and
C12A7328-F81F-11D2-BA4B-00A0C93EC93B for GPT
R - alias 'raid'
Linux RAID; means FD for MBR and
A19D880F-05FC-4D3B-A006-743F0F84911E for GPT
V - alias 'lvm'
LVM; means 8E for MBR and
E6D6D379-F507-44C2-A23C-238F2A3DF928 for GPT
The default type value is linux.
The shortcut 'X' for Linux extended partition (85) is deprecated
in favour of 'Ex'.
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 it might play a role for certain
boot loaders and for other operating systems.
Named-fields format
This format is more readable, robust, extensible and allows
specifying 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. sfdisk
extracts the partition
number from the device name. It allows specifying 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:
start=
number
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.
size=
number
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.
bootable
Mark the partition as bootable.
attrs=
string
Partition attributes, usually GPT partition attribute bits.
See --part-attrs
for more details about the GPT-bits string
format.
uuid=
string
GPT partition UUID.
name=
string
GPT partition name.
type=
code
A hexadecimal number (without 0x) for an MBR partition, a
GUID for a GPT partition, a shortcut as for unnamed-fields
format or a type name (e.g. type="Linux /usr (x86)"). See
above the section about the unnamed-fields format for more
details. For backward compatibility the Id=
field has the
same meaning.