Issue with resizing extended partition RHEL 7

Latest response

How do i resize the extended partition on RHEL 7.2 ? I tried to use "parted" command, however, realized that they do not have resize command there anymore. Instead of adding a new disk I simply increased the existing disk on VMware. I was able to see the increase in size there, however, I wanted to go beyond 4 partition and use the extended one to create a new partition for my logical partition inside there. However, I did not find anything that would help resizing the new extended partition.

Responses

If you have not yet rebooted the VM after extending the virtual disk, you may need to rescan the whole-disk device so that the kernel will detect the new size:

echo 1 > /sys/block/sda/device/rescan

(replace "sda" with the name of your actual whole-disk device)

After that, you may have to record the starting block number & length of each logical partition within the extended partition, and then delete the existing logical partitions and the extended partition, and finally recreate the existing partition in larger size and all the existing logical partitions exactly as they were. I'm not sure if parted is suitable for this; however, the old fdisk command should be able to do this without overwriting the partitions' actual contents.

This is actually why I prefer setting up VMs with a standard-sized system disk for OS, and a dedicated disk for the "payload" applications. This way, the applications disk can be initialized with LVM over the whole disk (e.g. "pvcreate /dev/sdb") and then it will be much easier to extend without fiddling with partition tables: just make sure the kernel has detected the new size of the disk (see above), then run "pvresize /dev/sdb" and you have usable free space in your VG for extending your LVs or creating new ones.

Hi Shisheer ! :) First of all : Never work on disks from within a running system - you might damage something badly. Also, resizing system partitions from within a running system isn't possible, because the system partition is mounted. The most easy and safe way to do it is to download the GParted Live ISO file from http://gparted.org and insert the ISO file into the VM. Then change the boot order of the VM in order to let it start from CDROM. Now start the VM and once the Live desktop of GParted appears, you are able to resize the partitions.

Hi, I agree with Christian here and would strongly suggest to follow his advice to use GParted Live CD. Using fdisk to edit the size of a partition is imho a technique from the last century.

There is a chance that in RHEL 7.4 parted comes with a backport of the resizepart command. See Bug 1423357 for details.

partx -v -a /dev/sdX

this should do it.

GParted is a GUI front-end for command line tools. Under the hood it uses a wide range of tool-kits, i.e.

GParted Required Software

There is enough of situations where a GUI is not possible. More important; learning to use and utilize the various filesystem tools in existence has a great advantage. They have a wide range of use beyond resizing partitions.

Sure GParted is a nice addition, – but command line gives a different level of control once one know when, how and what to use.