KandZ – Tuts

We like to help…!

Linux CLI 28 🐧 fdisk command

a - fdisk
fdisk is used to manage partition tables on HDD/SDD/devices
You can create, delete, resize partitions...
change their types or even check their status
fdisk -l → lists the partition tables of your devices
fdisk -l /dev/sda → lists the partition tables for sda device
fdisk -s /dev/sda → prints the size of sda partition
fdisk /dev/sda → press m → shows all the disk commands

b - create, delete and change partition type with fdisk
to create partition: fdisk /dev/sda → press n → press p for primary or extended
→ choose the partition number → enter first and last sector for this partition → w to write the changes
to delete partition: fdisk /dev/sda → press d → select partition number → w to write the changes
to change partition type: fdisk /dev/sda → press t → then L to list the partition types
→ enter the partition number you want → w to write the changes
to quit without writing the changes: q
You can also create new empty partition table :
b → for GPT, o → MBR, G → for SGI and s → Sun

Leave a Reply