#StackBounty: #partition #virtual-machine #size Virtual Machine can't extend /dev/mapper/vg0-rootvol

Bounty: 50

I have a virtual machine that I’m trying to extend from 150GB to 500GB.

$ sudo cfdisk /dev/sda
                         cfdisk (util-linux 2.23.2)

                            Disk Drive: /dev/sda
                     Size: 536870912000 bytes, 536.8 GB
           Heads: 255   Sectors per Track: 63   Cylinders: 65270

   Name        Flags     Part Type  FS Type         [Label]       Size (MB)
 --------------------------------------------------------------------------
                          Pri/Log   Free Space                         1.05*
   sda1        Boot       Primary   xfs                              536.88*
   sda2                   Primary   LVM2_member                   536333.00*

I’ve run fdisk (https://unix.stackexchange.com/a/134813/173008) to delete and create a new sda2 partition.

I am following this guide (https://unix.stackexchange.com/a/108229/173008), however I am stuck because I can’t extend vg0 to use this additional space.

$ df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/vg0-rootvol  146G  123G   16G  90% /
/dev/sda1                509M  268M  242M  53% /boot

$ sudo pvs
  PV         VG  Fmt  Attr PSize    PFree
  /dev/sda2  vg0 lvm2 a--  <149.50g    0

$ sudo vgs
  VG  #PV #LV #SN Attr   VSize    VFree
  vg0   1   2   0 wz--n- <149.50g    0

$ sudo lvs
  LV      VG  Attr       LSize    Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  rootvol vg0 -wi-ao---- <147.50g
  swap1   vg0 -wi-ao----    2.00g

The problem is there is no "extra space" on /dev/sda2, and still shows <149.5g, so running the following doesn’t work:

$ sudo pvresize /dev/sda2
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

$ sudo lvextend --size +350G /dev/mapper/vg0-rootvol
  Insufficient free space: 89600 extents needed, but only 0 available

I’m stuck and don’t know how to fix this. Any help would be appreciated.


Get this bounty!!!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.