Expand KVM image to use whole virtual disk question

Discussion in 'Installation/Configuration' started by Heeter, Jun 1, 2022.

  1. Heeter

    Heeter Member

    Hi all,

    This is for Ubuntu20LTS KVM server host with Ubuntu20LTS guest

    I am interested in increasing the size of one KVM guest, currently at 319G inside the guest:
    Code:
    root@webserv:/home/adminpc# pvs
      PV         VG         Fmt  Attr PSize    PFree
      /dev/vda1  webserv-vg lvm2 a--  <319.00g    0
    root@webserv:/home/adminpc# vgs
      VG         #PV #LV #SN Attr   VSize    VFree
      webserv-vg   1   2   0 wz--n- <319.00g    0
    root@webserv:/home/adminpc# lvs
      LV     VG         Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root   webserv-vg -wi-ao---- <318.04g                                                 
      swap_1 webserv-vg -wi-ao----  980.00m                                                 
    root@webserv:/home/adminpc#
    

    On the KVM host side, I don't need to adjust the actual LV's
    Code:
    root@serv:/home/adminpc# pvs
      PV         VG  Fmt  Attr PSize PFree
      /dev/sdd5  LVG lvm2 a--  1.63t 5.00g
    root@serv:/home/adminpc# vgs
      VG  #PV #LV #SN Attr   VSize VFree
      LVG   1   9   0 wz--n- 1.63t 5.00g
    root@serv:/home/adminpc# lvs
      LV        VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      bak       LVG -wi-ao----  7.50g                                                 
      home      LVG -wi-ao----  1.80g                                                 
      opt       LVG -wi-ao---- 52.00g                                                 
      root      LVG -wi-ao----  4.00g                                                 
      srv       LVG -wi-ao----  3.80g                                                 
      tmp       LVG -wi-ao----  3.50g                                                 
      usr       LVG -wi-ao---- 10.00g                                                 
      var       LVG -wi-ao----  4.00g                                                 
      vmstorage LVG -wi-ao----  1.54t                                                 
    root@serv:/home/adminpc#
    
    The actual guest that I am interested in increasing is located in LV/vmstorage, and it is called "webserv"
    Code:
    root@serv:/home/adminpc# cd /var/vmstorage
    root@serv:/var/vmstorage# virt-filesystems -l -h --all -a webserv
    Name                   Type       VFS  Label MBR Size Parent
    /dev/webserv-vg/root   filesystem ext4 -     -   318G -
    /dev/webserv-vg/swap_1 filesystem swap -     -   980M -
    /dev/webserv-vg/root   lv         -    -     -   318G /dev/webserv-vg
    /dev/webserv-vg/swap_1 lv         -    -     -   980M /dev/webserv-vg
    /dev/webserv-vg        vg         -    -     -   319G /dev/sda1
    /dev/sda1              pv         -    -     -   319G -
    /dev/sda1              partition  -    -     8e  319G /dev/sda
    /dev/sda               device     -    -     -   519G -
    root@serv:/var/vmstorage#
    
    The virtual harddisc space shows as 519G, the filesystem shows as 319G
    I would like to increase to image to use the whole 519G.

    I have tried "lvextend -l +100%FREE -r /dev/webserv-vg/root" inside guest but it is already maxed out
    Code:
    root@webserv:/home/adminpc# lvextend -l +100%FREE -r /dev/webserv-vg/root
      Size of logical volume webserv-vg/root unchanged from <318.04 GiB (81418 extents).
      Logical volume webserv-vg/root successfully resized.
    resize2fs 1.45.5 (07-Jan-2020)
    The filesystem is already 83372032 (4k) blocks long.  Nothing to do!
    
    root@webserv:/home/adminpc#
    
    Any help will be greatly appreciated
    Thank you
     

Share This Page