can't restore my lvms

Hurrah

Member
Jun 18, 2022
6
0
6
Sorry for my poor English.

When I want to extend my lvm-thin, I use this code maked a img from lvm-root:
Bash:
dd if=/dev/zero of=~/temp.img bs=1024M count=16

fdisk ~/temp.img

losetup -Pf --show ~/temp.img

pvcreate /dev/loop0p1

lvextend -l +100%FREE -r pve/root /dev/loop0p1 --force

## I forgot what I wrote then, but it almost like this.


when I finish the tasks , I removed the file temp.img.
then reboot my pve, my vms are all inactive,

Now I can't backup my vms, and can't start them.

How can I resolve this ?

Thanks for any help.

Below is my pvs/lvs information:
Bash:
root@pve:~# vgs
  Couldn't find device with uuid ULyj0T-yyH8-bm9C-U87I-7Bay-wtVP-GT8lpt.
  VG  #PV #LV #SN Attr   VSize   VFree
  pve   2   6   0 wz-pn- 127.28g    0
root@pve:~# pvs
  Couldn't find device with uuid ULyj0T-yyH8-bm9C-U87I-7Bay-wtVP-GT8lpt.
  PV         VG  Fmt  Attr PSize    PFree
  /dev/sda3  pve lvm2 a--  <111.29g    0
  [unknown]  pve lvm2 a-m   <16.00g    0
root@pve:~# lvs
  Couldn't find device with uuid ULyj0T-yyH8-bm9C-U87I-7Bay-wtVP-GT8lpt.
  LV            VG  Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  data          pve twi---tzp- 90.53g                                                   
  root          pve -wi-ao---- 27.75g                                                   
  swap          pve -wi-ao----  7.00g                                                   
  vm-101-disk-0 pve Vwi---tzp- 52.00m data                                               
  vm-102-disk-0 pve Vwi---tzp- 52.00g data                                               
  vm-103-disk-0 pve Vwi---tzp- 32.00g data                                               
root@pve:~# lvdisplay
  Couldn't find device with uuid ULyj0T-yyH8-bm9C-U87I-7Bay-wtVP-GT8lpt.
  --- Logical volume ---
  LV Path                /dev/pve/swap
  LV Name                swap
  VG Name                pve
  LV UUID                lbF2k4-BUsw-19rA-6T3g-zq3E-EWtC-Zxvedc
  LV Write Access        read/write
  LV Creation host, time proxmox, 2021-05-15 22:42:40 +0800
  LV Status              available
  # open                 2
  LV Size                7.00 GiB
  Current LE             1792
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0
  
  --- Logical volume ---
  LV Path                /dev/pve/root
  LV Name                root
  VG Name                pve
  LV UUID                KLVRGK-e0a9-1aXj-RGlw-00iv-dcvW-jM5I3w
  LV Write Access        read/write
  LV Creation host, time proxmox, 2021-05-15 22:42:40 +0800
  LV Status              available
  # open                 1
  LV Size                27.75 GiB
  Current LE             7104
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1
  
  --- Logical volume ---
  LV Name                data
  VG Name                pve
  LV UUID                D49kt8-FwgB-MxGm-UvnN-GokP-ch5Z-H2vKn4
  LV Write Access        read/write
  LV Creation host, time proxmox, 2021-05-15 22:42:40 +0800
  LV Pool metadata       data_tmeta
  LV Pool data           data_tdata
  LV Status              NOT available
  LV Size                90.53 GiB
  Current LE             23176
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  
  --- Logical volume ---
  LV Path                /dev/pve/vm-102-disk-0
  LV Name                vm-102-disk-0
  VG Name                pve
  LV UUID                KsabaN-vBsv-hPQ5-3aSn-htdX-TPXo-FbfQDF
  LV Write Access        read/write
  LV Creation host, time pve, 2021-06-02 00:21:26 +0800
  LV Pool name           data
  LV Status              NOT available
  LV Size                52.00 GiB
  Current LE             13312
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  
  --- Logical volume ---
  LV Path                /dev/pve/vm-101-disk-0
  LV Name                vm-101-disk-0
  VG Name                pve
  LV UUID                OqHfHA-IdCq-8ZRU-Xke5-fdl8-pRpo-jWPTNg
  LV Write Access        read/write
  LV Creation host, time pve, 2021-06-06 14:43:17 +0800
  LV Pool name           data
  LV Status              NOT available
  LV Size                52.00 MiB
  Current LE             13
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  
  --- Logical volume ---
  LV Path                /dev/pve/vm-103-disk-0
  LV Name                vm-103-disk-0
  VG Name                pve
  LV UUID                ucspbe-kALY-kmlB-OesG-IWFS-0SDN-eTFxhJ
  LV Write Access        read/write
  LV Creation host, time pve, 2021-06-12 13:29:46 +0800
  LV Pool name           data
  LV Status              NOT available
  LV Size                32.00 GiB
  Current LE             8192
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  
root@pve:~#
 
Last edited:
Here is my vg file content from /etc/lvm/archive/
Bash:
# Generated by LVM2 version 2.03.02(2) (2018-12-18): Wed Jun 15 00:08:51 2022

contents = "Text Format Volume Group"
version = 1

description = "Created *before* executing 'vgreduce --removemissing pve --force'"

creation_host = "pve"    # Linux pve 5.4.106-1-pve #1 SMP PVE 5.4.106-1 (Fri, 19 Mar 2021 11:08:47 +0100) x86_64
creation_time = 1655222931    # Wed Jun 15 00:08:51 2022

pve {
    id = "qVo4Wc-lmlH-VL13-6CTD-HsG8-9eIY-crjMCW"
    seqno = 69
    format = "lvm2"            # informational
    status = ["RESIZEABLE", "READ", "WRITE"]
    flags = []
    extent_size = 8192        # 4 Megabytes
    max_lv = 0
    max_pv = 0
    metadata_copies = 0

    physical_volumes {

        pv0 {
            id = "eHJOqA-K3vX-8Ncd-C9Tq-Bh0W-Dn20-ov5YHl"
            device = "/dev/sda3"    # Hint only

            status = ["ALLOCATABLE"]
            flags = []
            dev_size = 233390991    # 111.289 Gigabytes
            pe_start = 2048
            pe_count = 28489    # 111.285 Gigabytes
        }

        pv1 {
            id = "ULyj0T-yyH8-bm9C-U87I-7Bay-wtVP-GT8lpt"
            device = "[unknown]"    # Hint only

            status = ["ALLOCATABLE"]
            flags = ["MISSING"]
            dev_size = 33552351    # 15.999 Gigabytes
            pe_start = 2048
            pe_count = 4095    # 15.9961 Gigabytes
        }
    }

    logical_volumes {

        swap {
            id = "lbF2k4-BUsw-19rA-6T3g-zq3E-EWtC-Zxvedc"
            status = ["READ", "WRITE", "VISIBLE"]
            flags = []
            creation_time = 1621089760    # 2021-05-15 22:42:40 +0800
            creation_host = "proxmox"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 1792    # 7 Gigabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv0", 0
                ]
            }
        }

        root {
            id = "KLVRGK-e0a9-1aXj-RGlw-00iv-dcvW-jM5I3w"
            status = ["READ", "WRITE", "VISIBLE"]
            flags = []
            creation_time = 1621089760    # 2021-05-15 22:42:40 +0800
            creation_host = "proxmox"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 7104    # 27.75 Gigabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv0", 1792
                ]
            }
        }

        data {
            id = "D49kt8-FwgB-MxGm-UvnN-GokP-ch5Z-H2vKn4"
            status = ["READ", "WRITE", "VISIBLE"]
            flags = []
            creation_time = 1621089760    # 2021-05-15 22:42:40 +0800
            creation_host = "proxmox"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 23176    # 90.5312 Gigabytes

                type = "thin-pool"
                metadata = "data_tmeta"
                pool = "data_tdata"
                transaction_id = 25
                chunk_size = 128    # 64 Kilobytes
                discards = "passdown"
                zero_new_blocks = 1

                message1 {
                    delete = 1
                }
            }
        }

        vm-102-disk-0 {
            id = "KsabaN-vBsv-hPQ5-3aSn-htdX-TPXo-FbfQDF"
            status = ["READ", "WRITE", "VISIBLE"]
            flags = []
            creation_time = 1622564486    # 2021-06-02 00:21:26 +0800
            creation_host = "pve"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 13312    # 52 Gigabytes

                type = "thin"
                thin_pool = "data"
                transaction_id = 7
                device_id = 2
            }
        }

        vm-101-disk-0 {
            id = "OqHfHA-IdCq-8ZRU-Xke5-fdl8-pRpo-jWPTNg"
            status = ["READ", "WRITE", "VISIBLE"]
            flags = []
            creation_time = 1622961797    # 2021-06-06 14:43:17 +0800
            creation_host = "pve"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 13    # 52 Megabytes

                type = "thin"
                thin_pool = "data"
                transaction_id = 15
                device_id = 7
            }
        }

        vm-103-disk-0 {
            id = "ucspbe-kALY-kmlB-OesG-IWFS-0SDN-eTFxhJ"
            status = ["READ", "WRITE", "VISIBLE"]
            flags = []
            creation_time = 1623475786    # 2021-06-12 13:29:46 +0800
            creation_host = "pve"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 8192    # 32 Gigabytes

                type = "thin"
                thin_pool = "data"
                transaction_id = 16
                device_id = 8
            }
        }

        data_tdata {
            id = "fnuMeF-ANUP-qLdJ-WbLq-w7rj-FjZp-eQels0"
            status = ["READ", "WRITE"]
            flags = []
            creation_time = 1621089760    # 2021-05-15 22:42:40 +0800
            creation_host = "proxmox"
            segment_count = 3

            segment1 {
                start_extent = 0
                extent_count = 15530    # 60.6641 Gigabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv0", 8896
                ]
            }
            segment2 {
                start_extent = 15530
                extent_count = 3551    # 13.8711 Gigabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv0", 24938
                ]
            }
            segment3 {
                start_extent = 19081
                extent_count = 4095    # 15.9961 Gigabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv1", 0
                ]
            }
        }

        data_tmeta {
            id = "DnFiZ7-4dQB-fAhC-Cl7Z-jl9k-UmmA-BAeZL9"
            status = ["READ", "WRITE"]
            flags = []
            creation_time = 1621089760    # 2021-05-15 22:42:40 +0800
            creation_host = "proxmox"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 256    # 1024 Megabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv0", 24426
                ]
            }
        }

        lvol0_pmspare {
            id = "izIlHg-dG0r-k2HB-s20t-ZtkF-PoFK-Ggd0md"
            status = ["READ", "WRITE"]
            flags = []
            creation_time = 1621089760    # 2021-05-15 22:42:40 +0800
            creation_host = "proxmox"
            segment_count = 1

            segment1 {
                start_extent = 0
                extent_count = 256    # 1024 Megabytes

                type = "striped"
                stripe_count = 1    # linear

                stripes = [
                    "pv0", 24682
                ]
            }
        }
    }

}
 
i mean... why did you do this? you created a file on your root lv to extend the root lv and then deleted it? this will reliably break your lvm setup...

i guess you could try to boot from a live cd and shrink that root lv and remove the non-existing pv again... but depending if there was already
data on it, this may not work...
 
16GB ... smells like SD-Card. Any chance you have used an SD-Card for your installation? And it looks like you setup a striped lvm configuration which is not standard.

Your " data_tdata - segment 3" is now missing this disk. Did you remove your card or is it perhaps defective?
 
i mean... why did you do this? you created a file on your root lv to extend the root lv and then deleted it? this will reliably break your lvm setup...

i guess you could try to boot from a live cd and shrink that root lv and remove the non-existing pv again... but depending if there was already
data on it, this may not work...
Ah ye... this makes sense lol. Didnt read the initial post carefully. :D

Well, it was not a very smart move to delete that file... guess you can start over if there was any data on it.
 
i mean... why did you do this? you created a file on your root lv to extend the root lv and then deleted it? this will reliably break your lvm setup...

i guess you could try to boot from a live cd and shrink that root lv and remove the non-existing pv again... but depending if there was already
data on it, this may not work...
before I did those, there are two disks like below.
my vms' disks are on lvm-thin, and it is full, 0% free, my vms stoped.
So I intended to cut the free space from root lv to extend the data lv which is in lvm-thin.
First I made a file named ~/temp.img, then pvcreate and fdisk it , join it in vg(named 'pve'), lvextend to pve/data (sorry for wrong command in the #1 post)

These were what I've done.

Now I want to recovery my vm disks, or backup vm disks from the damaged LVM-thin part (and then setup the all vms again ).
Please help me! Thanks a lot.

1655733049183.png 1655734183263.png
1655734295598.png
 
thanks for your reply. :)
I deleted the file after finished extend the lv. and all things wrong. so it's lucky I have no time to write data to it.
Ah ye... this makes sense lol. Didnt read the initial post carefully. :D

Well, it was not a very smart move to delete that file... guess you can start over if there was any data on it.
 
Last edited: