Disk partitioning is the process of dividing a hard drive or other storage device into smaller, logical units called partitions. Each partition is treated as a separate storage device, and you can use it to store different types of data or to install different operating systems.
There are two main partitioning schemes: MBR (Master Boot Record) and GPT (GUID Partition Table). MBR is an older scheme that is limited to a maximum of four primary partitions or three primary partitions and one extended partition. GPT is a newer scheme that does not have this limitation and can support up to 128 partitions.
To use GPT for disk partitioning, you will need to use a tool such as fdisk, gdisk, or parted. Here is an example of how to use the parted tool to create a new GPT partition table and create a new partition on a disk:
- Open a terminal and use the following command to view a list of available disks:
- Identify the disk that you want to partition and note its name (e.g. /dev/sda).
- Use the following command to start the parted tool:
- Use the following command to create a new GPT partition table:
- Use the following command to create a new partition on the disk:
mkpart primary ext4 0% 100%
- Use the following command to exit the parted tool:
This will create a new GPT partition table on the disk and create a single primary partition that spans the entire disk. You can then format the partition and use it to store data or install an operating system.
Keep in mind that disk partitioning can be a complex process and it’s important to be careful when making changes to your disk. It’s always a good idea to back up your data before partitioning a disk.