Linux Disk Management

View all partitions

$ fdisk -l

View specific partition

$ fdisk -l /dev/sda

Print all partition table

$ fdisk /dev/sda
Command (m for help): p

Delete a partition

$ fdisk /dev/sda
Command (m for help): d
Partition number (1-4): 4
Command (m for help): w

Create new partition

$ fdisk /dev/sda
Command (m for help): n
Command action
   e   extended
   p   primary partition (1-4)
e
Command (m for help): w

Format a partition

$ mkfs.ext4 /dev/sda4

Check size of a partition

$ fdisk -s /dev/sda

Disk space usage

$ df -h

Partition information

$ sudo parted -l

Configure swap area on partitions