Parted
Last updated
Last updated
The parted
tool is a command-line utility in Linux used for managing disk partitions. It allows users to create, resize, delete, and modify partitions on hard drives or other storage devices. Unlike older tools like fdisk
, parted
supports larger disk sizes (over 2TB) and works with various partitioning schemes like GPT (GUID Partition Table) and MBR (Master Boot Record). It's a powerful tool for partition management, especially when dealing with advanced features like resizing partitions without losing data or creating partitions with different file systems.
Parted command can be opened following by entering the target disk to take action on , Replace xxx
with the target file system in you case
We can access the help page inside the pathed console by typing help
& the outupt should look like :
These commands provide a versatile set of tools for disk partitioning and management, offering functionality for creating, resizing, and adjusting partitions on Linux-based systems.
align-check TYPE N: Check partition N
for alignment (min
or opt
).
Example: align-check min 1
.
help [COMMAND]: Show help for a command.
Example: help mkpart
.
mklabel,mktable LABEL-TYPE: Create a new partition table (e.g., gpt
, msdos
).
Example: mklabel gpt
.
mkpart PART-TYPE [FS-TYPE] START END: Create a partition.
Example: mkpart primary ext4 0% 50%
.
name NUMBER NAME: Name a partition.
Example: name 1 "Data"
.
print [devices|free|list,all|NUMBER]: Display partition table or free space.
Example: print
.
quit: Exit parted
.
rescue START END: Recover a lost partition near START
and END
.
Example: rescue 100MB 200MB
.
resizepart NUMBER END: Resize partition NUMBER
to END
.
Example: resizepart 1 100GB
.
rm NUMBER: Delete partition NUMBER
.
Example: rm 1
.
select DEVICE: Select a device to edit.
Example: select /dev/sda
.
disk_set FLAG STATE: Set a flag (e.g., boot
) on the device.
Example: disk_set boot on
.
disk_toggle [FLAG]: Toggle a flag on the device.
Example: disk_toggle boot
.
set NUMBER FLAG STATE: Set a flag on partition NUMBER
.
Example: set 1 boot on
.
toggle [NUMBER [FLAG]]: Toggle a flag on a partition.
Example: toggle 1 boot
.
unit UNIT: Set size unit (e.g., MB, GB).
Example: unit MB
.
version: Display parted
version.
Example: version
.