Saturday, June 4, 2016
Linux users have used
fdisk for as long as can be remembered to partition their hard disks. However, as large hard disks have become more and more prevalent,
fdisk can no longer be used because it has a 2 TB partition limit. Luckily,
parted has been around for a long time and can be used to label and partition any modern sized hard disk.
This post will be an ever growing list of
parted commands to quickly get you started using it.
Keep in mind, unlike
parted command you execute happens in real time. This introduces much more room for human error that could cause data loss. It is your responsibility to understand this.
parted /dev/sdb print
parted /dev/sdb unit s print
parted /dev/sdb print free
parted /dev/sdb unit s print free
First, if needed, create a partition table label:
parted /dev/sdb mklabel gpt
Second, create the primary partition:
parted /dev/sdb mkpart primary 0 100%
After running the above command you will more than likely see the following warning message:
Warning: The resulting partition is not properly aligned for best performance.
To dig into why this occurs, and a possible solution, I suggest you read through how to align partitions for best performance using parted.
However, as suggested in the comments in that blog post, a quicker way to ensure
parted aligns the partition properly is to ensure the START and END parameters in the parted command use percentages instead of exact values.
parted /dev/sdb mkpart primary 0% 100%