13.2. Creating a Partition
Do not attempt to create a partition on a device that is in use.
Procedure 13.1. Creating a partition
- Before creating a partition, boot into rescue mode (or unmount any partitions on the device and turn off any swap space on the device).
/dev/sdais the device on which to create the partition:
# parted /dev/sda
- View the current partition table to determine if there is enough free space:
If there is not enough free space, you can resize an existing partition. Refer to Section 13.4, “Resizing a Partition” for details.
13.2.1. Making the Partition
From the partition table, determine the start and end points of the new partition and what partition type it should be. You can only have four primary partitions (with no extended partition) on a device. If you need more than four partitions, you can have three primary partitions, one extended partition, and multiple logical partitions within the extended. For an overview of disk partitions, refer to the appendix An Introduction to Disk Partitions in the Red Hat Enterprise Linux 6 Installation Guide.
For example, to create a primary partition with an ext3 file system from 1024 megabytes until 2048 megabytes on a hard drive type the following command:
# mkpart primary ext3 1024 2048
If you use the
mkpartfscommand instead, the file system is created after the partition is created. However,
parteddoes not support creating an ext3 file system. Thus, if you wish to create an ext3 file system, use
mkpartand create the file system with the
mkfscommand as described later.
The changes start taking place as soon as you press Enter, so review the command before executing to it.
After creating the partition, use the
cat /proc/partitionsafter parted is closed to make sure the kernel recognizes the new partition.
The maximum number of partitions parted will create is 128. While the GUID Partition Table (GPT) specification allows for more partitions by growing the area reserved for the partition table, common practice used by parted is to limit it to enough area for 128 partitions.