we have VM rhel machine version 7.6

example from lsblk

fd0                2:0    1     4K  0 disk
sda                8:0    0   300G  0 disk
├─sda1             8:1    0   500M  0 part /boot
├─sda2             8:2    0  39.5G  0 part
│ ├─VG-RHEL_root 253:0    0  40.9G  0 lvm  /
│ ├─VG-RHEL_swap 253:1    0   7.7G  0 lvm  [SWAP]
│ └─VG-RHEL_var  253:2    0 100.9G  0 lvm  /var
└─sda3             8:3    0   110G  0 part
  ├─VG-RHEL_root 253:0    0  40.9G  0 lvm  /
  └─VG-RHEL_var  253:2    0 100.9G  0 lvm  /var

before using parted

we increase the OS disk from vsphare client from 200G to 300G

then we rescan the sda disk and we get from lsblk 300 instead of previous 200G

now we want to use parted

but we get the following

  parted /dev/sda  resizepart 2 100%
Usage: parted [OPTION]... [DEVICE [COMMAND [PARAMETERS]...]...]
Apply COMMANDs with PARAMETERS to DEVICE.  If no COMMAND(s) are given, run in
interactive mode.
  -h, --help                      displays this help message
  -l, --list                      lists partition layout on all block devices
  -m, --machine                   displays machine parseable output
  -s, --script                    never prompts for user intervention
  -v, --version                   displays the version
  -a, --align=[none|cyl|min|opt]  alignment for new partitions

what could be wrong here?

  • The 100% is not supported. You need to use the new end position or omit it to maximize the size of the partition. – Mircea Vutcovici Nov 27 '20 at 14:34


parted -s /dev/sda resizepart 2

Unfortunately the free space is after sda3 partition and you can increase sda2 after you move sda3 towards the end of the disk. If you can shut down the VM, boot it from a GParted Live iso image and resize it with gparted

The syntax is: resizepart partition end See the parted man page for details.

Alternatively, you can also add space the the LVM volume group by:

  • creating an extended partition
  • inside the extended partition, create a logical partition of type LVM
  • use pvcreate to create a LVM disk label on the logical partition. This will be your new LVM physical volume
  • use vgextend to add the LVM physical volume to the LVM volume group
  • use lvextend --resizefs to resize the logical volume and the file system that is on top of it.

I wrote a script to help me with resizing of the block devices: https://github.com/mircea-vutcovici/scripts/blob/master/vol_resize.sh It is just preparing the commands to run, not doing any changes.

  • so do you think by replacing 100% to "end" it will succeeded ? – sheffadmin Nov 28 '20 at 19:49
  • no. You just need to remove "100%", not replace it with anything. – Mircea Vutcovici Nov 29 '20 at 5:03
  • we perform the parted -s /dev/sda resizepart 2 , and we get the same errors – sheffadmin Nov 29 '20 at 8:40
  • You need to add the extended partition, then logical one, create PV, then add the PV to VG, then increase the LV. Or you can move sda3 to the end of the disk with GParted Live. – Mircea Vutcovici Nov 29 '20 at 9:15
  • so you mean to add sda4 ? , in that case when using fdisk can we automate the fdisk process with sda4 creation ? – sheffadmin Nov 29 '20 at 9:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.