A filesystem resize can be done in several ways, online, offline, with LVM2 or without LVM2. However, this blog will describe how to do an online resize of ext3/ext4 filesystems where a virtual disk (vmdk) is online added to a VMware Redhat guest OS.
So let’s start with the online filesystem resize of ext3/4 filesystems on the Redhat guest OS. A new virutal disk (preferably an eagerd zero thick on VM running Oracle) was added as a pre requirement. Adding a new virtual disk is an online operation and no downtime is required to do it.
The whole procedure in this document is described by using the command line only. There is also a graphical user interface `system-config-lvm` that can perform the job, but that tool is out of scope in this document.
There are several steps that have to be done. These are in general:
Depending on the number of virtual controllers, you have to scan for your new LUN’s on each of these. In case you know on which the disk was added, then of course, you need to scan only the appropriate one.
1
|
# echo "- - -" > /sys/ class /scsi_host/host0/scan* |
1
|
# echo "- - -" > /sys/ class /scsi_host/host1/scan* |
1
2
3
|
# fdisk /dev/sdx?? # fdisk /dev/sdy?? |
Partprobe is a program that informs the operating system kernel of partition table changes, by requesting that the operating system re-read the partition table.
1
2
3
|
# partprobe /dev/sdx?? # partprobe /dev/sdy?? |
1
2
3
|
# pvcreate /dev/sdx?? Physical volume "/dev/sdx??" successfully created |
1
2
3
|
# pvcreate /dev/sdy?? Physical volume "/dev/sdy??" successfully created |
1
2
3
|
# vgextend VGOracle /dev/sdx?? Volume group "VGOracle" successfully extended |
1
2
3
|
# vgextend VGOracle /dev/sdy?? Volume group "VGOracle" successfully extended |
1
2
3
4
5
|
# lvextend -L 72G /dev/VGOracle/LVOracleu?? Extending logical volume LVOracleu?? to 72.00 GB Logical volume LVOracleu01 successfully resized |
After the logical volume is resized successfully, you can resize, in fact any filesystem that is online re-sizable. The following are examples for the ext3/ext4 filesystems. The syntax for ext3 and ext4 differ only slightly. For ext3 you use `resize2fs` even if its ext3 and not ext2, and in case of ext4 you use `resize4fs` were the command name is more logically.
1
|
# resize2fs /dev/VGOracle/LVOracleu?? |
1
|
# resize4fs /dev/VGOracle/LVOracleu?? |
That’s it. Now have fun with the bigger filesystem.
Article Number: 329
Posted: Wed, Jul 25, 2018 1:55 PM
Last Updated: Wed, Jul 25, 2018 1:55 PM
Online URL: http://kb.ictbanking.net/article.php?id=329