Chapter 12. Managing Disk Storage: Red Hat Enterprise Linux 4: System Administration Guide
Chapter 12. Managing Disk Storage: Red Hat Enterprise Linux 4: System Administration Guide
Chapter 12. Managing Disk Storage: Red Hat Enterprise Linux 4: System Administration Guide
Command Description
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
…cern.ch/linux/…/ch-disk-storage.html 1/6
3/24/2011 Managing Disk Storage
move minor-num start-mb Move the partition
end-mb
name minor-num name Name the partition for Mac and PC98 disklabels only
set minor-num flag state Set the flag on a partition; state is either on or off
The first line displays the size of the disk, the second line displays the disk label type, and the
remaining output shows the partition table.
In the partition table, the Minor number is the partition number. For example, the partition with minor
…cern.ch/linux/…/ch-disk-storage.html 2/6
3/24/2011 Managing Disk Storage
number 1 corresponds to /dev/sda1. The Start and End values are in megabytes. The Type is one
of primary, extended, or logical. The Filesystem is the file system type, which can be one of ext2,
ext3, fat16, fat32, hfs, jfs, linux-swap, ntfs, reiserfs, hp-ufs, sun-ufs, or xfs. The Flags column lists the
flags set for the partition. Available flags are boot, root, swap, hidden, raid, lvm, or lba.
In this example, minor number 1 refers to the /boot/ file system, minor number 2 refers to the root
file system (/), minor number 3 refers to the swap, and minor number 5 refers to the /home/ file
system.
Tip
To select a different device without having to restart parted, use the select
command followed by the device name such as /dev/sda. Then, you can view its
partition table or configure it.
Warning
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:
If there is not enough free space, you can resize an existing partition. Refer to Section 12.1.4 Resizing
a Partition for details.
…cern.ch/linux/…/ch-disk-storage.html 3/6
3/24/2011 Managing Disk Storage
Tip
If you use the 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. mkpartfs works for file system type
linux-swap.
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 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
Warning
Formatting the partition permanently destroys any data that currently exists on the
partition.
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.
mkdir /work
The first column should contain 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.
If the fourth column is the word defaults , the partition is mounted at boot time. To mount the
partition without rebooting, as root, type the command:
mount /work
Warning
Before removing 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 remove the partition:
parted /dev/sda
View the current partition table to determine the minor number of the partition to remove:
Remove the partition with the command rm. For example, to remove the partition with minor number
3:
rm 3
The changes start taking place as soon as you press [Enter], so review the command before
committing to it.
After removing the partition, use the print command to confirm that it is removed from the partition
table. You should also view the output of
cat /proc/partitions
…cern.ch/linux/…/ch-disk-storage.html 5/6
3/24/2011 Managing Disk Storage
Warning
Before resizing 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 resize the partition:
parted /dev/sda
View the current partition table to determine the minor number of the partition to resize as well as the
start and end points for the partition:
Warning
The used space of the partition to resize must not be larger than the new size.
To resize the partition, use the resize command followed by the minor number for the partition, the
starting place in megabytes, and the end place in megabytes. For example:
After resizing the partition, use the print command to confirm that the partition has been resized
correctly, is the correct partition type, and is the correct file system type.
After rebooting the system into normal mode, use the command df to make sure the partition was
mounted and is recognized with the new size.
Prev Home Next
Moving Swap Space Up LVM Partition Management
…cern.ch/linux/…/ch-disk-storage.html 6/6