# List partitions on BLKDEV, such as `/dev/sda`. fdisk -l [BLKDEV] # Usage: # fdisk [options] change partition table # fdisk [options] -l list partition table(s) # fdisk -s give partition size(s) in blocks # Options: # -b sector size (512, 1024, 2048 or 4096) # -c[=] compatible mode: 'dos' or 'nondos' (default) # -h print this help text # -u[=] display units: 'cylinders' or 'sectors' (default) # -v print program version # -C specify the number of cylinders # -H specify the number of heads # -S specify the number of sectors per track # To display partition table p # To delete a partition d # To display a list of partition types l or L # To create a new partition n # To change the type of a partition t # To write changes to fdisk w # Adding a new physical disk lsblk fdisk /dev/sdd # create new partition in fdisk mkfs.xfs /dev/sdd1 blkid /dev/sdd1 # edit /etc/fstab UUID= /opt defaults 0 0 # 00 disable disk checking and metadata dumping mount -a df -h /opt # Extending a physical disk (vm). Step 3 prints partitions on `/dev/sdc`. Step # 4 deletes the old partition, then creates a new one. 1. Unmount drive. Comment out `/etc/fstab` entry for `/dev/sdc`. 2. Increase drive physical space 3. parted /dev/sdc - 'p' 4. fdisk /dev/sdc - 'p' - 'd' - 'n' (defaults) - w 5. reboot 6. e2fsck -f /dev/sdc1 7. resize2fs /dev/sdc1 8. mount /dev/sdc1 - uncomment fstab