Rezise local-lvm

capelo

Member
Dec 12, 2021
4
0
6
37
Hi all,

My NVME disk failed 1 week before I implemented my backups and set them running and had to go to a data recovery lab.
The old disk was a 512GB one, and I asked to grab all the data and move to a new 1TB one (it was cloned).

I arrived home, and tried to rezise the local-lvm to be able to use the rest of the space on this new disk.
Saw that there is no GUI option to do that, but I could perform it by using the command lvextend -l +100%FREE /dev/mapper/pve-data

So I went to check the actual size:
Code:
nvme0n1                      259:0    0 931.5G  0 disk
├─nvme0n1p1                  259:1    0  1007K  0 part
├─nvme0n1p2                  259:2    0   512M  0 part /boot/efi
└─nvme0n1p3                  259:3    0 465.3G  0 part
  ├─pve-swap                 252:0    0     8G  0 lvm  [SWAP]
  ├─pve-root                 252:1    0    96G  0 lvm  /
  ├─pve-data_tmeta           252:2    0   3.5G  0 lvm 
  │ └─pve-data-tpool         252:4    0 338.4G  0 lvm 
  │   ├─pve-data             252:5    0 338.4G  1 lvm 
  │   ├─pve-vm--100--disk--0 252:6    0    20G  0 lvm 
  │   ├─pve-vm--105--disk--0 252:7    0     4M  0 lvm 
  │   ├─pve-vm--105--disk--1 252:8    0    32G  0 lvm 
  │   ├─pve-vm--107--disk--0 252:9    0     8G  0 lvm 
  │   ├─pve-vm--109--disk--0 252:10   0     2G  0 lvm 
  │   ├─pve-vm--110--disk--0 252:11   0     8G  0 lvm 
  │   ├─pve-vm--112--disk--0 252:12   0    20G  0 lvm 
  │   ├─pve-vm--113--disk--0 252:13   0    50G  0 lvm 
  │   ├─pve-vm--114--disk--0 252:14   0    50G  0 lvm 
  │   ├─pve-vm--117--disk--0 252:15   0     8G  0 lvm 
  │   ├─pve-vm--118--disk--0 252:16   0   512M  0 lvm 
  │   ├─pve-vm--116--disk--0 252:17   0     6G  0 lvm 
  │   ├─pve-vm--119--disk--0 252:18   0     8G  0 lvm 
  │   ├─pve-vm--120--disk--0 252:19   0    10G  0 lvm 
  │   └─pve-vm--106--disk--0 252:20   0    12G  0 lvm 
  └─pve-data_tdata           252:3    0 338.4G  0 lvm 
    └─pve-data-tpool         252:4    0 338.4G  0 lvm 
      ├─pve-data             252:5    0 338.4G  1 lvm 
      ├─pve-vm--100--disk--0 252:6    0    20G  0 lvm 
      ├─pve-vm--105--disk--0 252:7    0     4M  0 lvm 
      ├─pve-vm--105--disk--1 252:8    0    32G  0 lvm 
      ├─pve-vm--107--disk--0 252:9    0     8G  0 lvm 
      ├─pve-vm--109--disk--0 252:10   0     2G  0 lvm 
      ├─pve-vm--110--disk--0 252:11   0     8G  0 lvm 
      ├─pve-vm--112--disk--0 252:12   0    20G  0 lvm 
      ├─pve-vm--113--disk--0 252:13   0    50G  0 lvm 
      ├─pve-vm--114--disk--0 252:14   0    50G  0 lvm 
      ├─pve-vm--117--disk--0 252:15   0     8G  0 lvm 
      ├─pve-vm--118--disk--0 252:16   0   512M  0 lvm 
      ├─pve-vm--116--disk--0 252:17   0     6G  0 lvm 
      ├─pve-vm--119--disk--0 252:18   0     8G  0 lvm 
      ├─pve-vm--120--disk--0 252:19   0    10G  0 lvm 
      └─pve-vm--106--disk--0 252:20   0    12G  0 lvm

Then applied that command that supposedly should expand to all the free space, but it just increased a few GB:

Code:
root@pve:~# lvextend -l +100%FREE /dev/mapper/pve-data
  Size of logical volume pve/data_tdata changed from <338.36 GiB (86619 extents) to 354.35 GiB (90714 extents).
  Logical volume pve/data successfully resized.

Can someone tell me what I've done wrong and how can I fix it to be able to expand the local-lvm to use all the free space without losing my data?

Thank you for the help.

Screenshot 2025-01-09 at 1.14.11 AM.png
 
Hi,
the lvextend command can extend only to the space available in the volume group (vg).
The vg consists only of a single physical volume, which resides on nvme0n1p3 and is therefore limited by it's size.
Meaning: you need to resize the partition first (e.g. via parted) and then increase pv size (pvresize). After that the lvextend command should result in what you expect.
I haven't done that in a while, so it is best you search the web for details on the commands.
 
Firstly, let me start by saying that you must have a backup of all data somewhere else. After having paid (I assume) for data-recovery from that failed NVMe, I strongly advise you against just working on the only working copy you now have of that data. Any major data change (as you require in your situation) must have a full backup somewhere else. So make sure you have a safe copy of the newly cloned NVMe before starting any work on it.

Now to your main issue.

Code:
nvme0n1      259:0 0   931.5G  0  disk
 ├─nvme0n1p1 259:1 0   1007K  0   part
 ├─nvme0n1p2 259:2 0   512M   0   part /boot/efi
 └─nvme0n1p3 259:3 0   465.3G 0   part
As you can see your total space is 931.G but the total partition space used in only 512G as the clone is of another 512G disk.

Therefore the third partition must first be expanded to use the newly available space.

You cannot correctly & should not do this on a running system using that disk.

So you should live boot from another Linux live medium that includes Gparted. Then use Gparted to increase that nvme0n1p3 partition to the available size.

Then you need to resize the PV (physical volume) with the command:

pvresize /dev/nvme0n1p3

Then you should probably increase the metadata for the pve-data pool with:

lvresize --poolmetadatasize +4GB pve/data

After that you can increase the LV (logical volume) as you wish, with the:

lvresize -l +100%FREE pve/data

--------------------------------------------------------------------------------

NOTE: I have extracted the above from my notes - BUT I take no responsibility (implied or otherwise) for your actions.

You can research any of the above procedures online, either in this forum or other sites - as this is a pretty Linux-vanilla procedure.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!