Resizing Partitions and Growing Filesystems on RHEL 7.2 and 7.6 Machines: A Success Story
In this article, we will discuss the process of resizing partitions and growing filesystems on RHEL 7.2 and 7.6 machines. This is a common task for system administrators, and it is essential to have a clear understanding of the key concepts and steps involved. We will cover the following topics:
- Preparing for the resize operation
- Using fdisk to resize the partition
- Growing the filesystem
- Verifying the success of the operation
Preparing for the Resize Operation
Before you begin, it is important to ensure that you have a backup of any important data on the partition that you plan to resize. This is because the resize operation can potentially result in data loss if not performed correctly. It is also a good idea to unmount the partition that you plan to resize, as this will make the process safer and easier to perform.
Using fdisk to Resize the Partition
The fdisk utility is a powerful and versatile tool that can be used to manage disk partitions on Linux systems. To resize a partition using fdisk, you will first need to launch the utility by typing fdisk /dev/sda (where /dev/sda is the device name of the disk that contains the partition you want to resize).
Once fdisk is running, you can use the p command to display a list of the current partitions on the disk. To resize a partition, you will need to delete it and then recreate it with the new size. To do this, use the d command to delete the partition, and then use the n command to create a new partition with the desired size.
For example, if you wanted to resize the partition /dev/sda2 to use all available space on the disk, you would use the following commands:
d
2
n
p
2
a
2
1
w
This will delete the existing partition /dev/sda2 and create a new one that uses all available space on the disk. The a command is used to mark the partition as active (bootable), and the w command is used to write the changes to the disk and exit fdisk.
Growing the Filesystem
After resizing the partition, you will need to grow the filesystem to use the new space. This can be done using the resize2fs utility. For example, to grow the filesystem on the partition /dev/sda2, you would use the following command:
resize2fs /dev/sda2
This will grow the filesystem to use all available space on the partition.
Verifying the Success of the Operation
To verify that the resize operation was successful, you can use the df command to display the current filesystem usage. For example:
df -h
This will display a table showing the current usage of all mounted filesystems. You should see that the filesystem on the partition you resized has increased in size.
Resizing partitions and growing filesystems on RHEL 7.2 and 7.6 machines is a straightforward process, as long as you have a clear understanding of the key concepts and steps involved. By following the steps outlined in this article, you can successfully resize partitions and grow filesystems on your Linux machines.
References
- Red Hat Enterprise Linux 7 Storage Administration Guide: Partitions
- Red Hat Enterprise Linux 7 Storage Administration Guide: Resize Partitions
- fdisk man page
- resize2fs man page
This article was written using the following resources:
- Red Hat Enterprise Linux 7 Storage Administration Guide
- fdisk man page
- resize2fs man page
Types of references included:
- Online resources