GNU Parted utility

GNU Parted is a text-based partitioning utility that works with MBR, GPT, APM, BSD disk labels and other disk types. This utility was designed to minimize the chance of data loss, but it is still recommended to back up your files before using this program.

Using GNU Parted

To use GNU Parted, type the parted command, followed by the name of the disk you would like to partition. This opens up the GNU Parted prompt. For example, to partition the primary SATA disk, we would type the following command:

invoking parted

Once inside the prompt, you can type commands to accomplish various goals.

To display the current partition table, type print:

parted print partition table

To create a new partition, type mkpart. This opens up a series of questions about the new partition. Before creating the partition, execute the print command to view the current layout. For example, to create a 3 GB extended partition, we can use the following command:

parted create new partition

Note that the default units in parted are megabytes.

To remove a partition, type rm:

parted delete partition

In the example above you can see that we have deleted the partition number 3 that was created in the previous step.

To quit and save changes, type quit.

Geek University 2022