How to increase the size of the disk is LVM on Proxmox VE

Hello everyone, I want to share how I increased the disk on the virtual machine ProxMox without losing data and without adding a new disk partition in LVM volume group. Server installed ProxMox-VE 5.4 in VirtualBox, the entire amount of allocated disk was 40GB. Plans to increase the size of LVM logical volume data which is included in volume group pve.

Now the logical volume data is equal to 18.9 G. LVM Physical volume and volume Group pve which includes logical volume data is equal to 39.5 G.

How to increase disk LVM on ProxMox VE 5.4

So let’s start. Our first turn off the virtual machine in the VirtualBox program and add disk space to our virtual machine.

To change the size on 70ГБ:

In the picture below we see what we’ve got the new disk size:

Below you can see that the size of the sda drive has changed and become 70G. But the sda3 partition remained the old size.

1. Adjust the size of the LVM partition using Gparted

That’s how it will look if you are in VirtualBox, our virtual machine into the optical drive inserting an iso image of LinuxMint, boot from it and check using the Gparted program. It is seen that the LVM physical volume not changed:

Just say if you have the ability to run GParted as shown above, you can here change the size of sda3 without loss in the following way. Choose section -> sda3 in the menu, then Edit ->Resize/Move see below:

See below – pull the brown strip to the end to increase the size of the disk proxmox:

Click Resize:

Now to apply all the changes click on the tick:

After turning off the virtual machine, Proxmox, set first boot from hard drive -> run the virtual machine and see what the size of the logical group pve increased by 20G. And then in the console you can add the desired size, for example, the logical volume data with the command:

lvextend -L +10G /dev/pve/data

We have added a 10G logical volume data.

2. Increase the size of LVM Proxmox via terminal

But it so happens that the console is the ability to resize, and it is desirable to do this in the Virt. car. Let’s look at this option. Go back to the fact that we have added to our virtual machine free space using VirtualBox, And it looks like this:

If LiveCD see here how it looks:

So we loaded our virtual machine, Proxmox, went to it via ssh, typed lsblk, saw a new dimension sda = 70G. Now in the console will change the size of the partition sda3 and with it the size of the logical volume LMV c filename data:

The first thing to do is to put the program parted is a console version of Gparted:

apt update

apt install parted

After successful installation, go to partition and select disk /dev/sda. Please do not confuse is /dev/sda:

Then look at our partitions with the command print:

On top of the picture you can see that the size of our lvm disk 42.4 GB and his number 3. Will change it. Hire a team resizepart 3 and hit Enter:

Next, write 100% FREE this means that increase the drive to maximum and press Enter:

After execution, you can re-execute the command print and we will see the new size of our LVM volume which was 74.6 GB:

Next, go out using the command quit and press Enter:

Now let’s see how it looks with the command:

lsblk

So the above picture we see that the size of sda3 partition was 69.5 G but an LVM volume data to increase we will not be able, and will get an error, let’s try all the same to increase an LVM logical volume, and check:

We see that the changes were not applied because there is not enough space. If we boot from our LiveCD in a virtual machine and view using the Gparted program we see the following picture:

The fact that the partition sda3 , we have increased, but the LVM physical volume remains the same. LVM physical volume – as a result, and the group is the old LVM volume. To change this it is necessary to stretch the physical LVM volume on the free space we will use the command pvresize /dev/sda3 and press Enter:

In the lower picture the size of the physical volume has changed we can see it in the message:

Physical volume "/dev/sda3" changed
1 physical volume(s) resized / 0 physical volume(s) not resized

We also note that if after you type the commands pvs (INF. about physical volumes), vgs (INF. about groups LVM). But the vgs (INF. about logical volumes) shows the old data volume for root and swap since we still have to change.

So now displays the program Gparted if you boot with a LiveCD:

It remains only to add the free space to logical partition data. Recruit a team:

lvextend -L +20G /dev/pve/data

Our 20G added:

Check the changes introduced alternately commands:

pvs

vgs

lvs

We see that for pvs and vgs constant parameters, and the lvs command shows that the partition data was 38.87 G, we see that it increased by 20G. If we look at the previous output for the lvs command on the picture, then it can be seen that the logical volume data is 18.87 G:

In the web interface of our machine, we also see changes in the logical volume data:

Thank you all, glad to share the experience.

P. S. All actions better model in a virtual environment, as anything can happen…

Source: losst.ru

(Visited 32 times, 1 visits today)