parted
systemLinux/Unix
The parted command is one of the most frequently used commands in Linux/Unix-like operating systems. parted A disk partition manipulation program
Quick Reference
Command Name:
parted
Category:
system
Platform:
Linux/Unix
Basic Usage:
parted [options] [arguments]
Common Use Cases
Syntax
parted [options] [device [command [arguments]...]]
Options
Option | Description |
---|---|
-a, --align=[none|cyl|min|opt] |
Set alignment for new partitions |
-h, --help |
Display help information |
-l, --list |
List partition layout on all block devices |
-m, --machine |
Display machine parseable output |
-s, --script |
Never prompt for user intervention |
-v, --version |
Display the version |
Common Commands:
Command | Description |
---|---|
mklabel type |
Create a new disklabel (partition table) of type 'type' (e.g., 'gpt', 'msdos') |
mkpart [part-type name fs-type] start end |
Create a new partition, part-type is optional (primary/logical/extended), name is optional, fs-type is only for guidance |
print [number] |
Display the partition table or information about partition 'number' |
rm number |
Delete partition 'number' |
resizepart number end |
Resize partition 'number' to end at 'end' |
name number name |
Name partition 'number' as 'name' |
set number flag state |
Set 'flag' on partition 'number' to 'state' (on/off) |
unit unit |
Set the default unit to 'unit' (e.g., 's', 'B', 'MiB', 'GB') |
align-check type number |
Check if partition 'number' is aligned for 'type' (min/opt) |
rescue start end |
Rescue a lost partition between 'start' and 'end' |
help [command] |
Print general help, or help on 'command' |
quit |
Exit the program |
Examples
How to Use These Examples
The examples below show common ways to use the parted
command. Try them in your terminal to see the results. You can copy any example by clicking on the code block.
# Basic Examples Basic
sudo parted -l