-a
, --append
Don't create a new partition table, but only append the
specified partitions.
Note that unused partition maybe be re-used in this case
although it is not the last partition in the partition table.
See also -N
to specify entry in the partition table.
-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
option -O
, --backup-file
.
--color
[=
when]
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 the --help
output. See also the COLORS
section.
-f
, --force
Disable all consistency checking.
--Linux
Deprecated and ignored option. Partitioning that is
compatible with Linux (and other modern operating systems) is
the default.
--lock
[=mode]
Use exclusive BSD lock for device or file it operates. The
optional argument mode can be yes
, no
(or 1 and 0) or
nonblock
. If the mode argument is omitted, it defaults to
"yes"
. This option overwrites environment variable
$LOCK_BLOCK_DEVICE
. The default is not to use any lock at
all, but it's recommended to avoid collisions with udevd or
other tools.
-n
, --no-act
Do everything except writing to the device.
--no-reread
Do not check through the re-read-partition-table ioctl
whether the device is in use.
--no-tell-kernel
Don't tell the kernel about partition changes. This option is
recommended together with --no-reread
to modify a partition
on used disk. The modified partition should not be used
(e.g., mounted).
-O
, --backup-file
path
Override the default backup file name. Note that the device
name and offset are always appended to the file name.
--move-data
[=
path]
Move data after partition relocation, for example when moving
the beginning of a partition to another place on the disk.
The size of the partition has to remain the same, the new and
old location may overlap. This option requires option -N
in
order to be processed on one specific partition only.
The optional path specifies log file name. The log file
contains information about all read/write operations on the
partition data. The word "@default" as a path forces sfdisk
to use ~/sfdisk-<devname>.move for the log. The log is
optional since v2.35.
Note that this operation is risky and not atomic. Don't
forget to backup your data!
See also --move-use-fsync
.
In the example below, the first command creates a 100MiB free
area before the first partition and moves the data it
contains (e.g., a filesystem), the next command creates a new
partition from the free space (at offset 2048), and the last
command reorders partitions to match disk order (the original
sdc1 will become sdc2).
echo '+100M,' | sfdisk --move-data /dev/sdc -N 1 echo '2048,'
| sfdisk /dev/sdc --append sfdisk /dev/sdc --reorder
--move-use-fsync
Use the fsync(2) system call after each write when moving
data to a new location by --move-data
.
-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. This
option is not supported when using the --show-size
command.
-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
. The default or the current label may be
overwritten by the "label: <name>" script header line. The
option --label
does not force sfdisk
to create empty disk
label (see the EMPTY DISK LABEL
section below).
-Y
, --label-nested
type
Force editing of a nested disk label. The primary disk label
has to exist already. This option allows editing for example
a hybrid/protective MBR on devices with GPT.
-w
, --wipe
when
Wipe filesystem, RAID and partition-table signatures from the
device, in order to avoid possible collisions. The argument
when can be auto
, never
or always
. When this option is not
given, the default is auto
, in which case signatures are
wiped only when in interactive mode; except the old
partition-table signatures which are always wiped before
create a new partition-table if the argument when is not
never
. The auto
mode also does not wipe the first sector
(boot sector), it is necessary to use the always
mode to wipe
this area. In all cases detected signatures are reported by
warning messages before a new partition table is created. See
also the wipefs(8) command.
-W
, --wipe-partitions
when
Wipe filesystem, RAID and partition-table signatures from a
newly created partitions, in order to avoid possible
collisions. The argument when can be auto
, never
or always
.
When this option is not given, the default is auto
, in which
case signatures are wiped only when in interactive mode and
after confirmation by user. In all cases detected signatures
are reported by warning messages after a new partition is
created. See also wipefs(8) command.
-v
, --version
Display version information and exit.
-h
, --help
Display help text and exit.