[SOLVED] accident erased disk pve/data

fajar88

Member
Nov 20, 2023
2
0
6
I accidentally deleted pve/data thin volume in proxmox. Very next second i realised this and i tried to recovering it as below
ls -lrt /etc/lvm/archive
head /etc/lvm/archive/pve_00059-189435924.vg
vgcfgrestore pve --test -f /etc/lvm/archive/pve_00059-189435924.vg

TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
Consider using option --force to restore Volume Group pve with thin volumes.
Restore failed.
vgcfgrestore pve -f /etc/lvm/archive/pve_00059-189435924.vg --force



root@pve:~# lvscan
ACTIVE '/dev/pve/swap' [4.00 GiB] inherit
ACTIVE '/dev/pve/root' [96.00 GiB] inherit
inactive '/dev/pve/data' [7.13 TiB] inherit
inactive '/dev/pve/data_meta0' [15.81 GiB] inherit
inactive '/dev/pve/data_meta1' [15.81 GiB] inherit
root@pve:~# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 7.3T 0 disk
├─sda1 8:1 0 1007K 0 part
├─sda2 8:2 0 512M 0 part
└─sda3 8:3 0 7.3T 0 part
├─pve-swap 253:0 0 4G 0 lvm [SWAP]
└─pve-root 253:1 0 96G 0 lvm /
root@pve:~#

Log
Mar 29 17:39:44 pve kernel: device-mapper: thin: Data device (dm-3) discard unsupported: Disabling discard passdown.
Mar 29 17:39:44 pve pvestatd[821]: activating LV 'pve/data' failed: Thin pool pve-data-tpool (253:4) transaction_id is 20, while expected 18.
Mar 29 17:39:44 pve kernel: device-mapper: thin: Data device (dm-3) discard unsupported: Disabling discard passdown.
Mar 29 17:39:44 pve pvestatd[821]: status update time (373.332 seconds)
Mar 29 17:39:44 pve pvedaemon[848]: activating LV 'pve/data' failed: Thin pool pve-data-tpool (253:4) transaction_id is 20, while expected 18.
Mar 29 17:39:44 pve kernel: device-mapper: thin: Data device (dm-3) discard unsupported: Disabling discard passdown.
 
Hopefully, this will be helpful if someone encounters the same issue, as the problem can be resolved with the following steps:

Step 1:

  1. Check the directory /etc/lvm/archive/
  2. Check the name of the latest data before you perform the deletion action with the following command:
sqlCopy code
root@pve:~# ls -lrt /etc/lvm/archive/
total 1148
-rw------- 1 root root 897 Dec 14 08:51 External-Disk_00000-376973015.vg
-rw------- 1 root root 897 Dec 14 08:56 External-Disk_00001-372733421.vg
-rw------- 1 root root 965 Dec 14 08:56 External-Disk_00002-981036317.vg
-rw------- 1 root root 2704 Dec 14 09:02 External-Disk_00003-194963410.vg
-rw------- 1 root root 3120 Dec 19 15:51 External-Disk_00004-1759896110.vg

  1. Type the following command:
cssCopy code
vgcfgrestore pve -f /etc/lvm/archive/(filename you want to recover) --force

For example:

bashCopy code
vgcfgrestore pve -f /etc/lvm/archive/pve_00022-1456241366.vg --force

If you encounter an error like "activating LV 'pve/data' failed: Thin pool pve-data-tpool (253:6) transaction_id is 20, while expected 19", follow the steps explained by user elvasilep in the following thread: https://forum.proxmox.com/threads/t...transaction_id-is-32-while-expected-29.83616/