12.2. Creating a Partition
Procedure 12.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:
12.2.1. Making the Partition
# mkpart primary 1024 2048
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.
cat /proc/partitionsafter parted is closed to make sure the kernel recognizes the new partition.
12.2.2. Formatting and Labeling the Partition
Procedure 12.2. Format and Label the Partition
- The partition does not have a file system. To create the
ext4file system, use:
WarningFormatting the partition permanently destroys any data that currently exists on the partition.
- Next, give the file system on the partition a label. For example, if the file system on the new partition is
/dev/sda6and you want to label it
# e2label /dev/sda6 /work
/work) as root.
12.2.3. Add to
/etc/fstabfile to include the new partition using the partition's UUID. Use the command
blkid -o listfor a complete list of the partition's UUID, or
blkid devicefor individual device details.
UUID=followed by the file system's UUID. 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
defaults, the partition is mounted at boot time. To mount the partition without rebooting, as root, type the command: