fdisk and parted — partition a disk
cheat sheet · Ubuntu 24.04 · util-linux 2.39 · parted 3.6 https://lab.dimsanych.ru/en/wiki/fdisk-parted/Cheat sheet
-
lsblkwhich disks exist -
sudo fdisk -l /dev/vdbthe disk's partition table -
sudo parted /dev/vdb printthe same with parted -
sudo parted -s /dev/vdb mklabel gptnew table (wipes the old one) -
sudo parted -s /dev/vdb mkpart data ext4 1MiB 100% -
sudo parted /dev/vdb unit MiB print freepartitions and free space -
sudo fdisk /dev/vdbstep by step: g, n, w -
sudo partprobe /dev/vdbkernel re-reads the table
Options
parted has few options; the work is done by commands: mklabel, mkpart, print,
rm, resizepart, name. Inside fdisk you type one-letter commands; m lists
them. The full lists are in man parted and man fdisk.