A compact, practical guide to using parted to create and manage disk partitions from the shell. 19.04.2026 | reading time: 3 min Parted is a powerful command line partition editor that lets the administrator create, modify and inspect partition tables on MBR and GPT disks; this short guide shows concrete commands to get a disk ready for a filesystem. Make a GPT disk and an ext4 partition Follow these commands and outputs to initialize a spare disk and create one partition, then format it; run them as root or with sudo then mount the device. ```bash sudo parted /dev/sdb --script mklabel gpt sudo parted /dev/sdb --script mkpart primary ext4 1MiB 100% sudo parted /dev/sdb --script print ``` ```text Model: VBOX HARDDISK (scsi) Disk /dev/sdb: 16.0GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 1049kB 16.0GB 16.0GB ext4 ``` Then create a filesystem and mount it: ```bash sudo mkfs.ext4 -F /dev/sdb1 sudo mkdir -p /mnt/data && sudo mount /dev/sdb1 /mnt/data lsblk -f /dev/sdb ``` ```text /dev/sdb ├─sdb1 ext4 ``` Practical switches you will use Use `--script` to avoid interactive prompts in scripts, `mklabel` to set MBR or GPT, `mkpart` to make partitions, and `print` to inspect the layout; also use `unit` to change display units and `name` or `set` to tag partitions, for example `parted /dev/sdb set 1 boot on` to set a flag. When to prefer parted Pick parted for GPT support, precise unit control like MiB alignment, creating hybrid layouts and scripting batch operations; choose fdisk if you need a quick MBR-only edit or gdisk for GPT-focused interactive work. Safety and workflow tips Always check `lsblk` and `blkid` after changes, update `/etc/fstab` entries if UUIDs change, run `partprobe` or reboot to notify the kernel of table updates, and remember parted does not create filesystems for you so follow up with `mkfs` when needed. Further reading and next steps Try rebuilding a test VM disk from scratch to practice, then automate disk setup in a script for reproducible labs; deepen the skill set by studying storage, filesystems and certification guides at bitsandbytes.academy to prepare for exams like CompTIA Linux+ or LPIC-1. Join Bits & Bytes Academy First class LINUX exam preparation. filesystem utilities storage