parted
GNU Parted is a program that allows you to create, destroy, resize, move, and copy disk partitions. It supports multiple partitioning formats and can detect various file systems.
Description
GNU Parted is a disk partition manipulator useful for creating space for new operating systems, reorganizing disk usage, and copying data to new hard disks. The main 'parted' package contains the binary and manual page, supporting DOS, Mac, Sun, BSD, GPT, MIPS, and PC98 partitioning formats, as well as loop (raw disk) type for RAID/LVM. It can detect and remove file systems like ASFS/AFFS/APFS, Btrfs, ext2/3/4, FAT16/32, HFS, JFS, linux-swap, UFS, XFS, and ZFS, though creating/modifying file systems is deprecated.
Parted operates in interactive mode or scripted mode with various options for alignment and output formats. Related packages include libparted2t64 (shared library), libparted-dev (development files), libparted-i18n (localization), libparted-fs-resize0t64 (FS resizing library), parted-doc (documentation), and partprobe (informs OS of partition changes). The tool warns that bugs could cause data loss, so backups are essential.
Partprobe utility notifies the operating system about partition table changes, with options for dry-run and summary.
How It Works
Parted manipulates disk partition tables by creating, resizing, moving, or destroying partitions using commands like mkpart, mklabel, and align-check. It supports multiple partition table types (DOS, GPT, etc.) and alignment options (none|cyl|min|opt). The tool reads/writes directly to block devices, detects file systems for partition operations, and uses libraries like libparted2t64. Partprobe triggers kernel re-reading of updated partition tables without rebooting.
Installation
sudo apt install partedFlags
Examples
parted -hparted -lparted -mparted -jparted --script /dev/sda mklabel gptparted /dev/sda align-check opt 1partprobepartprobe -s