0

Hi I am using a cloud provider (not AWS) to extend the file system on an Ubuntu VM. The provider has extended it, and notified that the extension is on the same volume, but I cannot seem to figure out how to extend it. I can see the additional space with lsblk:

$ sudo lsblk
NAME         MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
vda          252:0    0  200G  0 disk
├─vda1       252:1    0  487M  0 part /boot
├─vda2       252:2    0    1K  0 part
└─vda5       252:5    0 99.5G  0 part
  ├─vg0-swap 253:0    0  2.9G  0 lvm  [SWAP]
  └─vg0-root 253:1    0 96.7G  0 lvm  /

while fdisk shows:

$ sudo fdisk -l
Disk /dev/vda: 200 GiB, 214748364800 bytes, 419430400 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2df69e85

Device     Boot   Start       End   Sectors  Size Id Type
/dev/vda1  *       2048    999423    997376  487M 83 Linux
/dev/vda2       1001470 209713151 208711682 99.5G  5 Extended
/dev/vda5       1001472 209713151 208711680 99.5G 8e Linux LVM


Disk /dev/mapper/vg0-swap: 2.9 GiB, 3070230528 bytes, 5996544 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/vg0-root: 96.7 GiB, 103788052480 bytes, 202711040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

but I cannot figure out how to extend the root partition to take advantage of the extra 100GB that have been added.

In the past, using ec2, this was very simple:

I think there must be a very simple way to do this, but I cannot figure it out, and an hour or so of google has been no help.

EDIT: with the suggested link: https://serverfault.com/a/1049885/16985 the growpart seems to have worked and now lsblk shows:

sudo lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
vda          252:0    0   200G  0 disk
├─vda1       252:1    0   487M  0 part /boot
├─vda2       252:2    0     1K  0 part
└─vda5       252:5    0 199.5G  0 part
  ├─vg0-swap 253:0    0   2.9G  0 lvm  [SWAP]
  └─vg0-root 253:1    0  96.7G  0 lvm  /

however resize2fs and xfs_growfs do not impact the Avail space or the lvm volume sizes. One step closer for sure though.

EDIT2: thanks to @michael_hampton I was able to complete the final steps with:

now everything looks hunky-dory:

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
vda          252:0    0   200G  0 disk
├─vda1       252:1    0   487M  0 part /boot
└─vda5       252:5    0 199.5G  0 part
  ├─vg0-swap 253:0    0   2.9G  0 lvm  [SWAP]
  └─vg0-root 253:1    0 196.7G  0 lvm  /
e7zkw9120
  • 173
  • 3
  • 8
  • 2
    Does this answer your question? [Resize partition at VPS without losing data](https://serverfault.com/questions/1049806/resize-partition-at-vps-without-losing-data) – Michael Hampton Feb 01 '21 at 16:00
  • This part got really close: https://serverfault.com/a/1049885/16985 I have updated. Specifically, this grew the vda5 partition, but the lvm root partition is still stuck. – e7zkw9120 Feb 01 '21 at 16:08
  • See here to expand the LVM volume: https://serverfault.com/a/953181/126632 – Michael Hampton Feb 01 '21 at 16:17
  • no luck. none of these commands seem to extend the vg0-root lvm volume. – e7zkw9120 Feb 01 '21 at 16:28
  • this one was the magic! https://stackoverflow.com/a/28500826/100322 thank you sooo much for your hints! – e7zkw9120 Feb 01 '21 at 16:32

0 Answers0