System information
Chapter 13. Partitions
The utility parted allows users to:
View the existing partition table
Change the size of existing partitions
Add partitions from free space or additional hard drives
By default, the parted package is included when installing Red Hat Enterprise Linux. To start
parted , log in as root and type the command parted /dev/sda at a shell prompt (where
/dev/sda is the device name for the drive you want to configure).
If you want to remove or resize a partition, the device on which that partition resides must not be in
use. Creating a new partition on a device which is in use—while possible—is not recommended.
For a device to not be in use, none of the partitions on the device can be mounted, and any swap
space on the device must not be enabled.
As well, the partition table should not be modified while it is in use because the kernel may not
properly recognize the changes. If the partition table does not match the actual state of the mounted
partitions, information could be written to the wrong partition, resulting in lost and overwritten data.
The easiest way to achieve this it to boot your system in rescue mode. When prompted to mount the
file system, select Ski p.
Alternately, if the drive does not contain any partitions in use (system processes that use or lock the
file system from being unmounted), you can unmount them with the umo unt command and turn off all
the swap space on the hard drive with the swapo ff command.
Table 13.1, “ parted commands” contains a list of commonly used parted commands. The sections
that follow explain some of these commands and arguments in more detail.
T able 13.1. parted co mman d s
Co mman d Descrip t io n
check minor-num Perform a simple check of the file system
cp from to Copy file system from one partition to another;
from and to are the minor numbers of the
partitions
hel p Display list of available commands
mkl abel label Create a disk label for the partition table
mkfs minor-num file-system-type Create a file system of type file-system-type
mkpart part-type fs-type start-mb
end-mb
Make a partition without creating a new file
system
mkpartfs part-type fs-type start-mb
end-mb
Make a partition and create the specified file
system
mo ve minor-num start-mb end-mb Move the partition
name minor-num name Name the partition for Mac and PC98 disklabels
only
pri nt Display the partition table
q ui t Quit parted
rescue start-mb end-mb Rescue a lost partition from start-mb to end-mb
resi ze minor-num start-mb end-mb Resize the partition from start-mb to end-mb
Red Hat Ent erprise Lin ux 6 St orage Admin ist rat io n G uide
90