Showing results for 
Search instead for 
Did you mean: 

extend partition

Frequent Advisor

extend partition

greetings folks,

Now i need to extend a partition on a VM running RHEL 5.5. Not sure on the approach of unmounting and using resize2fs. Following is what i need to grow.
/dev/sdb1 1 33418 268430053+ 83 Linux
Dmidecode output
dmidecode | grep -i manu
Manufacturer: VMware, Inc.
Any thoughts ideas are really appreciated.

Honored Contributor

Re: extend partition

Before you can extend the filesystem, you must extend the partition it's in. Is /dev/sdb1 the only partition on this (virtual) disk, or does /dev/sdb[2-9] exist?

What is the output of these commands?
cat /proc/partitions |grep sdb
fdisk -l /dev/sdb

If you've already extended the /dev/sdb virtual device at the VMware host level, the system might already indicate the new size for /dev/sdb, while /dev/sdb1 still has its old size. If it doesn't, run "partprobe" and check again.

Since it doesn't seem like you're using LVM, if /dev/sdb has other partitions, you must move them so that /dev/sdb1 has free space immediately after it. This can be done with the "move" command of "parted", but requires that the partition being moved must be unmounted.

If /dev/sdb1 is the only partition on this (virtual) disk, you can extend it relatively easily. On RHEL 5, it should be possible to do this while the partition is still mounted. You can use the "resize" command of "parted", or even "fdisk" if you're very careful. After resizing the partition, you may have to run "partprobe" again to make the system detect the new size.

Once /proc/partitions indicates the new size for /dev/sdb1, you can use "resize2fs /dev/sdb1" to make the new space usable to the filesystem. You don't even have to unmount the filesystem for this: in RHEL 5, resizefs will simply say "filesystem is mounted, on-line resizing required" and do the right thing.