I lost my data thin lvm - how to re-create it?

praxmaxl

Active Member
Feb 2, 2021
8
7
43
67
Trying to add a secondary hdd to my new proxmox-9 installation I managed to loose the data lv.

Code:
root@pve:~# lvs
  LV   VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root pve -wi-ao---- 12.66g                                                  
  swap pve -wi-ao----  3.50g

should be something like

Code:
# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%
  data pve  twi-a-tz--   4.38g             0.00   0.63
  root pve  -wi-ao----   1.75g
  swap pve  -wi-ao---- 896.00m

how can I get it back and maybe create it with using the additional pv I have on /dev/sdb1?

Code:
root@pve:~# pvs
  PV         VG     Fmt  Attr PSize   PFree 
  /dev/sda3  pve    lvm2 a--   28.82g  12.66g
  /dev/sdb1  vmdata lvm2 a--  698.63g 698.63g

I'd prefer using the cli rather then the webgui.
 
Last edited:
Trying to add a secondary hdd to my new proxmox-9 installation I managed to loose the data lv.

Code:
root@pve:~# lvs
  LV   VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root pve -wi-ao---- 12.66g                                                
  swap pve -wi-ao----  3.50g

should be something like

Code:
# lvs
  LV   VG   Attr       LSize   Pool Origin Data%  Meta%
  data pve  twi-a-tz--   4.38g             0.00   0.63
  root pve  -wi-ao----   1.75g
  swap pve  -wi-ao---- 896.00m

how can I get it back and maybe create it with using the additional pv I have on /dev/sdb1?

Code:
root@pve:~# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda3  pve    lvm2 a--   28.82g  12.66g
  /dev/sdb1  vmdata lvm2 a--  698.63g 698.63g

I'd prefer using the cli rather then the webgui.

Does this thread have the answer? https://forum.proxmox.com/threads/mounting-old-proxmox-hdd-to-new-installation.160503/

or any of these


Option 1: Combine into the existing pve Volume Group
This expands your primary VG with the new disk, then provisions a new thin pool data.
  1. Extend the Volume Group pve using your new Physical Volume /dev/sdb1: vgextend pve /dev/sdb1
  2. Recreate the logical volume for the thin pool (replace $SIZE with your desired size, or use 100%FREE to use all available space): lvcreate -l +100%FREE -n data pve
  3. Convert the logical volume into an LVM Thin Pool: lvconvert --type thin-pool pve/data
Option 2: Keep /dev/sdb1 as a separate Volume Group

If you prefer to keep /dev/sdb1 completely separate from your base Proxmox system disk, you can create a dedicated vmdata Volume Group instead.
  1. Create a Volume Group named vmdata on /dev/sdb1: vgcreate vmdata /dev/sdb1
  2. Create the thin pool data within the new Volume Group (replace $SIZE with a specific size like -L 600G, or use -l +100%FREE): lvcreate -l +100%FREE -T -n data vmdata
Once the thin pool exists, you can format and finalize your setup.
 
Last edited:
use 100%FREE to use all available space
Don't ever use 100% for a thin pool. You want some unallocated in case it gets full and you need to repair.
how can I get it back and maybe create it with using the additional pv I have on /dev/sdb1?
I don't think you can combine them in this state. You'd have to add both PVs to one VG. I wouldn't recommend it. Try this
Bash:
# Or whatever else % you want (not 100%). You can always extend but not shrink
lvcreate -l +95%FREE -T -n data vmdata
pvesm add lvmthin --vgname vmdata --thinpool data local-lvm
 
Last edited:
@Impact

Code:
lvcreate -l +95%FREE -T -n data vmdata
.. went fine, but

Code:
root@pve:~# pvesm add lvmthin --vgname vmdata --thinpool data local-lvm
create storage failed: storage ID 'local-lvm' already defined
 
Either use a different name or delete the existing one first. For example
Bash:
pvesm remove local-lvm