¿Cómo agregar espacio libre no asignado usando Shell en Centos?

¿Cómo agregar espacio libre no asignado usando Shell en Centos?

Tengo algo de espacio libre sin asignar y este problema afecta a más instancias.

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  1075MB  1074MB  primary  xfs          boot
 2      1075MB  34.4GB  33.3GB  primary               lvm
        34.4GB  53.7GB  19.3GB           Free Space

¿Cómo puedo solucionar este problema utilizando scripts de shell? Es imposible realizar operaciones utilizando cfdisk en cada instancia.

ingrese la descripción de la imagen aquí

sfdisk-l

[root@test ~]# sfdisk -l

Disk /dev/sda: 6527 cylinders, 255 heads, 63 sectors/track
Units: cylinders of 8225280 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/sda1   *      0+    130-    131-   1048576   83  Linux
/dev/sda2        130+   4177-   4047-  32504832   8e  Linux LVM
/dev/sda3          0       -       0          0    0  Empty
/dev/sda4          0       -       0          0    0  Empty

Disk /dev/mapper/centos_template--centos7-root: 3758 cylinders, 255 heads, 63 sectors/track

Disk /dev/mapper/centos_template--centos7-swap: 417 cylinders, 255 heads, 63 sectors/track

PVS

[root@test ~]# pvs
  PV         VG                      Fmt  Attr PSize    PFree
  /dev/sda1  centos_template-centos7 lvm2 a--  1020.00m    0
  /dev/sda2  centos_template-centos7 lvm2 a--   <31.00g    0

[root@test ~]# vgdisplay
  --- Volume group ---
  VG Name               centos_template-centos7
  System ID
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  6
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               31.99 GiB
  PE Size               4.00 MiB
  Total PE              8190
  Alloc PE / Size       8190 / 31.99 GiB
  Free  PE / Size       0 / 0
  VG UUID               OtZy5d-vzvd-ojJw-247H-Bzd7-Xezz-QCFFIu

información relacionada