1

I have an Ubuntu 16.04.6 LTS server that runs under MS HyperV. The only disk in the system, a vhdx, is installed under Ubuntu as a single physical and logical volume via LVM.

I have enlarged the disk within HyperV. What now is the correct procedure to enlarge the LVM volumes within Ubuntu?

As far as a I can see the drive appears the same size within Ubuntu, even after forcing a SCSI rescan. fdisk moans that the disk is managed by LVM and lists no partitions, though the only (dated) information I have found online suggests using it to delete and recreate the partitions there - live. I'm obviously a little nervous to do that to the server without knowing for sure that this is the current correct way to do this.

2
  • The best solution I have found for this issue to date is to shutdown the VM, make a checkpoint as a backup, download the GParted Live USB/CD ISO, add it to the VM, arrange your boot order so it boots first, boot GParted Live, and then you can resize your volume to fill the expanded size. When done, shut down, remove the GParted ISO from your VM, and reboot your VM. You should have all your free space now. Dec 18, 2019 at 19:00
  • I have a VM that I set up a few months ago to muck about with LVM disks. I increased the size of one of the disks with the VM offline. I restarted the VM and ran Gparted (Version 1.0.0). It showed the additional space as unallocated. I was able to resize the existing partition to make use of the unallocated space. “sudo pvs” showed the increase in this physical volume. “sudo vgdisplay” showed free PE available. “sudo lvextend” made the additional space available to my logical disk. You might find this link helpful tecmint.com/extend-and-reduce-lvms-in-linux
    – PonJar
    Dec 20, 2019 at 7:33

1 Answer 1

0

You are using LVM to manage your partitions. You have to first extend your physical volume using pvresize command. Example (assuming you want to extend the physical volume to entire disk and /dev/sda is the name of your PV):

pvresize /dev/sda

You can get list of PVs by pvdisplay or pvscan (See https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/6/html/logical_volume_manager_administration/physvol_display for more details).

After you have extended your PV, you need to extend your LV by lvextend command. Example:

lvextend -l +100%FREE /dev/VGNAME/LVNAME

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .