Creating a Partition
Do not attempt to create a partition on a device that is in use.
Before creating a partition, boot into rescue mode (or unmount any partitions on the device and turn off any swap space on the device).
Start parted
, where /dev/sda
is the device on which to create the partition:
parted /dev/sda
View the current partition table to determine if there is enough free space:
print
If there is not enough free space, you can resize an existing partition. Refer to "Resizing a Partition" for details.
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 Community Enterprise Linux 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:
If you use the 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 to make sure the kernel recognizes the new partition. The partition still does not have a file system. Create the file system:
Formatting the partition permanently destroys any data that currently exists on the partition. Next, give the partition a label. For example, if the new partition is By default, the installation program uses the mount point of the partition as the label to make sure the label is unique. You can use any label you want. As root, create the mount point:
As root, edit the The first column should contain If the fourth column is the word Making the Partition
mkpart primary ext3 1024 2048
mkpartfs
command instead, the file system is created after the partition is created. However, parted
does not support creating an ext3 file system. Thus, if you wish to create an ext3 file system, use mkpart
and create the file system with the mkfs
command as described later.
print
command to confirm that it is in the partition table with the correct partition type, file system type, and size. Also remember the minor number of the new partition so that you can label it. You should also view the output of
cat /proc/partitions
Formatting the Partition
mkfs -t ext3 /dev/
sda6
Labeling the Partition
/dev/sda6
and you want to label it /work
:
e2label /dev/sda6 /work
Creating the Mount Point
mkdir /work
Add to
/etc/fstab
/etc/fstab
file to include the new partition. The new line should look similar to the following:
LABEL=/work /work ext3 defaults 1 2
LABEL=
followed by the label you gave the partition. The second column should contain the mount point for the new partition, and the next column should be the file system type (for example, ext3 or swap). If you need more information about the format, read the man page with the command man fstab
.
defaults
, the partition is mounted at boot time. To mount the partition without rebooting, as root, type the command:
mount /work