0

I did run out of disc space for the root partition in Ubunut 20.04. This is a guest system on Virtualbox.

Therefore I did:

  1. Resized disk in virtualbox
  2. Attached it to another linux box
  3. Booted the other box
  4. Resized pv

Now it looks like this:

sde                         8:64   0   25G  0 disk 
├─sde1                      8:65   0    1M  0 part 
├─sde2                      8:66   0    1G  0 part 
└─sde3                      8:67   0   14G  0 part 
  └─ubuntu--vg-ubuntu--lv 252:2    0   14G  0 lvm  
sr0                        11:0    1 1024M  0 rom  
user@rex:~$ sudo vgdisplay ubuntu-vg
  --- Volume group ---
  VG Name               ubuntu-vg
  System ID             
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               14.00 GiB
  PE Size               4.00 MiB
  Total PE              3583
  Alloc PE / Size       3583 / 14.00 GiB
  Free  PE / Size       0 / 0   
  VG UUID               KVTTtl-f56L-SG26-iIVK-Wquq-5ZsL-LpDafi

sudo pvresize /dev/sde3
  Physical volume "/dev/sde3" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized

sudo pvs
  PV         VG        Fmt  Attr PSize  PFree
  /dev/sde3  ubuntu-vg lvm2 a--  14.00g    0 

The 25G apear to be there, but the PE still shows 14G. How can the volume be increased from here?

merlin
  • 2,033
  • 11
  • 37
  • 72
  • The PV is inside sde3, but is not really sde3. You didn't resize sde3, with a partition tool. See for example https://serverfault.com/questions/861517/centos-7-extend-partition-with-unallocated-space/953625#953625 . Be careful, if using UEFI you should use an other tool like gdisk and must keep or put back the same uuid. Also don't accept the tool's offer to wipe PV signature. – A.B May 24 '21 at 22:05

1 Answers1

1

as A.B stated, you have to resize the partition first. Since this is the last partition on the disk, it can be done easily. I tend to prefer parted over fdisk in these situations.

parted /dev/sde resizepart 3 100%

And here is an actual dialog I had (just changed the diskname and partition number to match yours) while resizing from 44To to 50To. Note that parted asked all the questions again, strange but harmless.

root@server # parted /dev/sde resizepart 3 100%
Warning: Not all of the space available to /dev/sde appears to be used, you can fix the GPT to use all of the space (an extra 20971520000 blocks) or continue with the current setting?
parted: invalid token: 3
Fix/Ignore? Fix
Partition number? 3
Warning: Partition /dev/sde3 is being used. Are you sure you want to continue?
Yes/No? Yes
End?  [44.0TB]? 100%

The answers were Fix, 3, Yes and 100%.

Then, follow A.B's link an continue with pvresize, lvresize etc...

exore
  • 308
  • 2
  • 10