Redhat 7/8 – Create GPT Partition with Parted command

i) Login as root user, execute the parted command with the disk devices in command prompt

ii) Type print. You will see a message about an unrecognized disk label

iii) Now we have to write the partition table to a new disk. To do so, type mklabel and press enter. Then parted will prompt for a disk label type. If you not sure what disk label type to select, just press the Tab key twice to see a list of available disk label type.

From the list, type gpt and press Enter

To verify the partition table is gpt, just type print

You also can view the partition free space by just type print free

If you wish to view the free disk space in MB, you also can do so

iv) Now we will use the mkpart subcommand to start creating the new partition (primary or extended partition)

Type mkpart and enter. The utility will prompt Partition name (you can enter any partition name).

Now the utility will prompt for a file system type. By default, system will suggest ext2 which is not recommend to use it. You also can press the Tab key twice to see a list of available file system type.

I going to use xfs. So, just type xfs and press Enter to continue

Utility will prompt for start number of blocks or an offset from the start of the device. In my example here, i type 1MB as start of the partition and 2048000MB as the end of the partition.

To verify the partition, you can just type print free

v) If you want to modify the existing partitions size, you can use resizepart command to make the modification.

A) Increase partition size

B) Decrease partition size

Once you done create or resize the partition, type quit to exit the utility and commit the changes.

vi) Now the newly created disk is ready to use. You can list the available disk by enter parted -l command

Leave a Reply

Your email address will not be published. Required fields are marked *