HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

sfdisk — Display or manipulate a disk partition table. More information: <https://manned.org/sfdisk>.

Submitted by: @import:tldr-pages··
0
Viewed 0 times
tablesfdiskcommanddiskpartitionmanipulateclidisplay
linux

Problem

How to use the sfdisk command: Display or manipulate a disk partition table. More information: <https://manned.org/sfdisk>.

Solution

sfdisk — Display or manipulate a disk partition table. More information: <https://manned.org/sfdisk>.

Back up the partition layout to a file:
sudo sfdisk {{[-d|--dump]}} {{/dev/sdX}} > {{path/to/file.dump}}


Restore a partition layout:
sudo sfdisk < {{path/to/file.dump}} {{/dev/sdX}}


Set the type of a partition:
sudo sfdisk --part-type {{/dev/sdX}} {{partition_number}} {{swap}}


Delete a partition:
sudo sfdisk --delete {{/dev/sdX}} {{partition_number}}


Display help:
sfdisk {{[-h|--help]}}

Code Snippets

Back up the partition layout to a file

sudo sfdisk {{[-d|--dump]}} {{/dev/sdX}} > {{path/to/file.dump}}

Restore a partition layout

sudo sfdisk < {{path/to/file.dump}} {{/dev/sdX}}

Set the type of a partition

sudo sfdisk --part-type {{/dev/sdX}} {{partition_number}} {{swap}}

Delete a partition

sudo sfdisk --delete {{/dev/sdX}} {{partition_number}}

Display help

sfdisk {{[-h|--help]}}

Context

tldr-pages: linux/sfdisk

Revisions (0)

No revisions yet.