отображать или управлять таблицей разделов диска (display or manipulate a disk partition table)
Команды (Commands)
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. The
unspecified fields of the partition are not modified.
Note that it's possible to address an unused partition with
-N
. For example, an MBR always contains 4 partitions, but the
number of used partitions may be smaller. In this case sfdisk
follows the default values from the partition table and does
not use built-in defaults for the unused partition given with
-N
. See also --append
.
-A
, --activate
device [partition-number...]
Switch on the bootable flag for the specified partitions and
switch off the bootable flag on all unspecified partitions.
The special placeholder '-' may be used instead of the
partition numbers to switch off the bootable flag on all
partitions.
The activation command is supported for MBR and PMBR only. If
a GPT label is detected, then sfdisk
prints warning and
automatically enters PMBR.
If no partition-number is specified, then list the partitions
with an enabled flag.
--delete
device [partition-number...]
Delete all or the specified partitions.
-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. For
backward compatibility the deprecated option
--show-pt-geometry
have the same meaning as this one.
-J
, --json
device
Dump the partitions of a device in JSON format. Note that
sfdisk
is not able to use JSON as input format.
-l
, --list
[device...]
List the partitions of all or the specified devices. This
command can be used together with --verify
.
-F
, --list-free
[device...]
List the free unpartitioned areas on all or the specified
devices.
--part-attrs
device partition-number [attributes]
Change the GPT partition attribute bits. If attributes is not
specified, then print the current partition settings. The
attributes argument is a comma- or space-delimited list of
bits numbers or bit names. For example, the string
"RequiredPartition,50,51" sets three bits. The currently
supported attribute bits are:
Bit 0 (RequiredPartition)
If this bit is set, the partition is required for the
platform to function. The creator of the partition
indicates that deletion or modification of the contents
can result in loss of platform features or failure for
the platform to boot or operate. The system cannot
function normally if this partition is removed, and it
should be considered part of the hardware of the system.
Bit 1 (NoBlockIOProtocol)
EFI firmware should ignore the content of the partition
and not try to read from it.
Bit 2 (LegacyBIOSBootable)
The partition may be bootable by legacy BIOS firmware.
Bits 3-47
Undefined and must be zero. Reserved for expansion by
future versions of the UEFI specification.
Bits 48-63
Reserved for GUID specific use. The use of these bits
will vary depending on the partition type. For example
Microsoft uses bit 60 to indicate read-only, 61 for
shadow copy of another partition, 62 for hidden
partitions and 63 to disable automount.
--part-label
device partition-number [label]
Change the GPT partition name (label). If label is not
specified, then print the current partition label.
--part-type
device partition-number [type]
Change the partition type. If type is not specified, then
print the current partition type.
The type argument is hexadecimal for MBR, GUID for GPT, type
alias (e.g. "linux") or type shortcut (e.g. 'L'). For
backward compatibility the options -c
and --id
have the same
meaning as this one.
--part-uuid
device partition-number [uuid]
Change the GPT partition UUID. If uuid is not specified, then
print the current partition UUID.
--disk-id
device [id]
Change the disk identifier. If id is not specified, then
print the current identifier. The identifier is UUID for GPT
or unsigned integer for MBR.
-r
, --reorder
device
Renumber the partitions, ordering them by their start offset.
-s
, --show-size
[device...]
List the sizes of all or the specified devices in units of
1024 byte size. This command is DEPRECATED in favour of
blockdev(8).
-T
, --list-types
Print all supported types for the current disk label or the
label specified by --label
.
-V
, --verify
[device...]
Test whether the partition table and partitions seem correct.
--relocate
oper device
Relocate partition table header. This command is currently
supported for GPT header only. The argument oper can be:
gpt-bak-std
Move GPT backup header to the standard location at the
end of the device.
gpt-bak-mini
Move GPT backup header behind the last partition. Note
that UEFI standard requires the backup header at the end
of the device and partitioning tools can automatically
relocate the header to follow the standard.