Creating and deleting partitions in Linux is a regular practice because storage devices (such as hard drives and USB drives) must be structured in some way before they can be used. In most cases, large storage devices are divided into separate sections called partitions. Partitioning also allows you to divide your hard drive into isolated sections, where each section behaves as its own hard drive. Partitioning is particularly useful if you run multiple operating systems.
There are lots of powerful tools for creating, removing, and otherwise manipulating disk partitions in Linux. In this article, I'll explain how to use the parted
command, which is particularly useful with large disk devices and many disk partitions. Differences between parted
and the more common fdisk
and cfdisk
commands include:
- GPT format: The
parted
command can create a Globally Unique Identifiers Partition Table GPT[1]), whilefdisk
andcfdisk
are limited to DOS partition tables. - Larger disks: A DOS partition table can format up to 2TB of disk space, although up to 16TB is possible in some cases. However, a GPT partition table can address up to 8ZiB of space.
- More partitions: Using primary and extended partitions, DOS partition tables allow only 16 partitions. With GPT, you get up to 128 partitions by default and can choose to have many more.
- Reliability: Only one copy of the partition table is stored in a DOS partition. GPT keeps two copies of the partition table (at the beginning and the end of the disk). The GPT also uses a CRC[2] checksum to check the partition table integrity, which is not done