ThorneLabs

parted Commands Cheat Sheet

• Updated June 7, 2019


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.

Disclaimer

Unlike fdisk, every parted command executes in real time. This introduces much more room for human error that could cause data loss. I am not, nor is anyone else, responsible for any potential data loss when using parted.

parted /dev/sdb print
parted /dev/sdb unit s print
parted /dev/sdb print free
parted /dev/sdb unit s print free

Create Partitions

Create a Primary Partition Using All Disk Space

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%

References

If you found this post useful and would like to help support this site - and get something for yourself - sign up for any of the services listed below through the provided affiliate links. I will receive a referral payment from any of the services you sign-up for.

Get faster shipping and more with Amazon Prime: About to order something from Amazon but want to get more value out of the money you would normally pay for shipping? Sign-up for a free 30-day trial of Amazon Prime to get free two-day shipping, access to thousands of movies and TV shows, and more.

Thanks for reading and take care.