锐单电子商城 , 一站式电子元器件采购平台!
  • 电话:400-990-0325

centos8中lvm丢失PV找回方法步骤

时间:2022-12-18 22:30:00 guh5红外线传感器

机器重启后vmstore卷丢失pvscan、vgscan、lvscan均不到vmstore卷。
先执行fdisk -l,检查磁盘分区,发现/dev/sdb /dev/sdc两个磁盘已经挂载/dev/mapper目录下。
第一步,先删除mapper

[root@node103 ~]# pvscan   PV /dev/sdd2   VG onn              lvm2 [277.87 GiB / 54.18 GiB free]   PV /dev/sda    VG gluster_vg_sda   lvm2 [558.91 GiB / 0    free]   Total: 2 [836.78 GiB] / in use: 2 [836.78 GiB] / in no VG: 0 [0   ] [root@node103 ~]# vgcfgrestore vmstore   WARNING: Couldn't find device with uuid m8ZIeU-j2eU-8ZMK-q52W-Zcjd-hqij-JSG8XF                                                                                                                               .   WARNING: Couldn't find device with uuid pHlCKc-wvGK-4DKX-m5IF-IXig-BZJM-YqX38s                                                                                                                               .   Cannot restore Volume Group vmstore with 2 PVs marked as missing.   Restore failed. [root@node103 ~]# cd /etc/lvm/backup/ [root@node103 backup]# ls gluster_vg_sda  onn  vmstore [root@node103 backup]# cd vmstore -bash: cd: vmstore: Not a directory [root@node103 backup]# ls gluster_vg_sda  onn  vmstore [root@node103 backup]# pvcreate --uuid 'm8ZIeU-j2eU-8ZMK-q52W-Zcjd-hqij-JSG8XF' --restorefile                                                                                                                   
      
       /etc
       /lvm
       /backup
       /vmstore 
       /dev
       /sdb WARNING
       : Couldn
       't find device with uuid m8ZIeU
       -j2eU
       -
       8ZMK
       -q52W
       -Zcjd
       -hqij
       -JSG8XF
       . WARNING
       : Couldn
       't find device with uuid pHlCKc
       -wvGK
       -
       4DKX
       -m5IF
       -IXig
       -BZJM
       -YqX38s
       . Cannot use 
       /dev
       /sdb
       : device is a multipath component 
       [root@node103 backup
       ]# fdisk 
       -l Disk 
       /dev
       /sdd
       : 
       278.9 GiB
       , 
       299439751168 bytes
       , 
       584843264 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disklabel type
       : dos Disk identifier
       : 
       0xe6ac2d12 Device Boot Start End Sectors Size Id Type 
       /dev
       /sdd1 
       * 
       2048 
       2099199 
       2097152 
       1G 
       83 Linux 
       /dev
       /sdd2 
       2099200 
       584843263 
       582744064 
       277.9G 
       8e Linux LVM Disk 
       /dev
       /sda
       : 
       558.9 GiB
       , 
       600127266816 bytes
       , 
       1172123568 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /sdc
       : 
       838.4 GiB
       , 
       900185481216 bytes
       , 
       1758174768 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /sdb
       : 
       838.4 GiB
       , 
       900185481216 bytes
       , 
       1758174768 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /mapper
       /onn
       -ovirt
       --node
       --ng
       --
       4.4
       .
       10.2
       --
       0.20220303
       .
       0
       +
       1
       : 
       169 GiB
       , 
       181466562560 bytes
       , 
       354426880 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /onn
       -swap
       : 
       15.7 GiB
       , 
       16840130560 bytes
       , 
       32890880 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /mapper
       /
       350014ee7aaad2514
       : 
       838.4 GiB
       , 
       900185481216 bytes
       , 
       1758174768 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /mapper
       /
       350014ee7000283fc
       : 
       838.4 GiB
       , 
       900185481216 bytes
       , 
       1758174768 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /mapper
       /onn
       -var_log_audit
       : 
       2 GiB
       , 
       2147483648 bytes
       , 
       4194304 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /onn
       -var_log
       : 
       8 GiB
       , 
       8589934592 bytes
       , 
       16777216 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /onn
       -var_crash
       : 
       10 GiB
       , 
       10737418240 bytes
       , 
       20971520 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /onn
       -var
       : 
       15 GiB
       , 
       16106127360 bytes
       , 
       31457280 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /onn
       -tmp
       : 
       1 GiB
       , 
       1073741824 bytes
       , 
       2097152 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /onn
       -home
       : 
       1 GiB
       , 
       1073741824 bytes
       , 
       2097152 sectors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       65536 bytes 
       / 
       65536 bytes Disk 
       /dev
       /mapper
       /gluster_vg_sda
       -gluster_lv_engine
       : 
       100 GiB
       , 
       107374182400 bytes
       , 
       209715200 sec tors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       512 bytes 
       / 
       512 bytes Disk 
       /dev
       /mapper
       /gluster_vg_sda
       -gluster_lv_data
       : 
       480 GiB
       , 
       515396075520 bytes
       , 
       1006632960 sect ors Units
       : sectors of 
       1 
       * 
       512 
       = 
       512 bytes Sector 
       size 
       (logical
       /physical
       )
       : 
       512 bytes 
       / 
       512 bytes I
       /O 
       size 
       (minimum
       /optimal
       )
       : 
       131072 bytes 
       / 
       262144 bytes 
       [root@node103 backup
       ]# blkid 
       /dev
       /mapper
       /onn
       -var_crash
       : UUID
       =
       "00050fc2-5319-46da-b6c2-b0557f602845" BLOCK_SIZE
       =
       "512" TYPE
       = 
       "xfs" 
       /dev
       /sdd2
       : UUID
       =
       "DWXIm1-1QSa-qU1q-0urm-1sRl-BEiz-NaemIW" TYPE
       =
       "LVM2_member" PARTUUID
       =
       "e6ac2d1 2-02" 
       /dev
       /sdd1
       : UUID
       =
       "840d0f88-c5f0-4a98-a7dd-73ebf347a85b" BLOCK_SIZE
       =
       "512" TYPE
       =
       "xfs" PARTUUID
       =
       " e6ac2d12-01" 
       /dev
       /sda
       : UUID
       =
       "kMvSz0-GoE5-Q0vf-qrjM-3H5m-NCLg-fSTZb8" TYPE
       =
       "LVM2_member" 
       /dev
       /sdc
       : UUID
       =
       "pHlCKc-wvGK-4DKX-m5IF-IXig-BZJM-YqX38s" TYPE
       =
       "LVM2_member" 
       /dev
       /sdb
       : UUID
       =
       "m8ZIeU-j2eU-8ZMK-q52W-Zcjd-hqij-JSG8XF" TYPE
       =
       "LVM2_member" 
       /dev
       /mapper
       /onn
       -ovirt
       --node
       --ng
       --
       4.4
       .
       10.2
       --
       0.20220303
       .
       0
       +
       1
       : UUID
       =
       "8bef5e42-0fd1-4595-8b3c-0791 27a2c237" BLOCK_SIZE
       =
       "512" TYPE
       =
       "xfs" 
       /dev
       /mapper
       /onn
       -swap
       : UUID
       =
       "18284c2e-3596-4596-b0e8-59924944c417" TYPE
       =
       "swap" 
       /dev
       /mapper
       /
       350014ee7aaad2514
       : UUID
       =
       "m8ZIeU-j2eU-8ZMK-q52W-Zcjd-hqij-JSG8XF" TYPE
       =
       "LVM2_membe r" 
       /dev
       /mapper
       /
       350014ee7000283fc
       : UUID
       =
       "pHlCKc-wvGK-4DKX-m5IF-IXig-BZJM-YqX38s" TYPE
       =
       "LVM2_membe r" 
       /dev
       /mapper
       /onn
       -var_log_audit
       : UUID
       =
       "928237b1-7c78-42d0-afca-dfd362225740" BLOCK_SIZE
       =
       "512" T YPE
       =
       "xfs" 
       /dev
       /mapper
       /onn
       -var_log
       : UUID
       =
       "cb6aafa3-9a97-4dc5-81f6-d2da3b0fdcd9" BLOCK_SIZE
       =
       "512" TYPE
       =
       "x fs" 
       /dev
       /mapper
       /onn
       -var
       : UUID
       =
       "47b2e20c-f623-404d-9a12-3b6a31b71096" BLOCK_SIZE
       =
       "512" TYPE
       =
       "xfs" 
       /dev
       /mapper
       /onn
       -tmp
       : UUID
       =
       "599eda13-d184-4a59-958c-93e37bc6fdaa" BLOCK_SIZE
       =
       "512" TYPE
       =
       "xfs" 
       /dev
       /mapper
       /onn
       -home
       : UUID
       =
       "ef67a11a-c786-42d9-89d0-ee518b50fce5" BLOCK_SIZE
       =
       "512" TYPE
       =
       "xfs" 
       /dev
       /mapper
       /gluster_vg_sda
       -gluster_lv_engine
       : UUID
       =
       "3b99a374-baa4-4783-8da8-8ecbfdb227a4" BLO CK_SIZE
       =
       "512" TYPE
       =
       "xfs" 
       /dev
       /mapper
       /gluster_vg_sda
       -gluster_lv_data
       : UUID
       =
       "eb5ef30a-cb48-4491-99c6-3e6c6bfe3f69" BLOCK _SIZE
       =
       "512" TYPE
       =
       "xfs" 
       [root@node103 backup
       ]# dmsetup remove 
       350014ee7aaad2514 
       [root@node103 backup
       ]# dmsetup remove 
       350014ee7000283fc 
      

可以通过 lsblk blkid 等命令查看磁盘uuid
第二步,查看vmstore卷,没有找到

[root@node103 ~]# pvscan
  PV /dev/sdd2   VG onn              lvm2 [277.87 GiB / 54.18 GiB free]
  PV /dev/sda    VG gluster_vg_sda   lvm2 [558.91 GiB / 0    free]
  Total: 2 [836.78 GiB] / in use: 2 [836.78 GiB] / in no VG: 0 [0   ]
[root@node103 ~]# vgcfgrestore vmstore
  WARNING: Couldn't find device with uuid m8ZIeU-j2eU-8ZMK-q52W-Zcjd-hqij-JSG8XF            .
  WARNING: Couldn't find device with uuid pHlCKc-wvGK-4DKX-m5IF-IXig-BZJM-YqX38s            .
  Cannot restore Volume Group vmstore with 2 PVs marked as missing.
  Restore failed.
[root@node103 ~]# cd /etc/lvm/backup/
[root@node103 backup]# ls
gluster_vg_sda  onn  vmstore[root@node103 backup]# more vmstore
# Generated by LVM2 version 2.03.12(2)-RHEL8 (2021-05-19): Tue Jun 7 10:42:40 2022

contents = "Text Format Volume Group"
version = 1

description = "Created *after* executing 'lvcreate -l 100%VG -n lv_store vmstore'"

creation_host = "node103"       # Linux node103 4.18.0-365.el8.x86_64 #1 SMP Thu Feb 10 16:11
:23 UTC 2022 x86_64
creation_time = 1654569760      # Tue Jun  7 10:42:40 2022

vmstore { 
       
        id = "HmgGJN-YzQf-8Kks-k36u-3kU1-yBRj-bMM6ME"
        seqno = 2
        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 = "m8ZIeU-j2eU-8ZMK-q52W-Zcjd-hqij-JSG8XF"
                        device = "/dev/sdb"     # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 1758174768   # 838.363 Gigabytes
                        pe_start = 2048
                        pe_count = 214620       # 838.359 Gigabytes
                }

                pv1 { 
       
                        id = "pHlCKc-wvGK-4DKX-m5IF-IXig-BZJM-YqX38s"
                        device = "/dev/sdc"     # Hint only

                        status = ["ALLOCATABLE"]
                        flags = []
                        dev_size = 1758174768   # 838.363 Gigabytes
                        pe_start = 2048
                        pe_count = 214620       # 838.359 Gigabytes
                }
        }

        logical_volumes { 
       

                lv_store { 
       
                        id = "KP7KUD-n7ZO-XMmY-d6De-dd8j-dR15-jdPF4X"
                        status = ["READ", "WRITE", "VISIBLE"]
                        flags = []
                        creation_time = 1654569760      # 2022-06-07 10:42:40 +0800
                        creation_host = "node103"
                        segment_count = 2

                        segment1 { 
       
                                start_extent = 0
                                extent_count = 214620   # 838.359 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv0", 0
                                ]
                        }
                        segment2 { 
       
                                start_extent = 214620
                                extent_count = 214620   # 838.359 Gigabytes

                                type = "striped"
                                stripe_count = 1        # linear

                                stripes = [
                                        "pv1", 0
                                ]
                        }
                }
        }

}
[root@node103 backup]#

[root@node103 backup]# lsblk
NAME                                        MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
sda                                           8:0    0 558.9G  0 disk
├─gluster_vg_sda-gluster_lv_engine          253:14   0   100G  0 lvm   /gluster_bricks/engine
├─gluster_vg_sda-gluster_thinpool_gluster_vg_sda_tmeta
│                                           253:15   0     3G  0 lvm
│ └─gluster_vg_sda-gluster_thinpool_gluster_vg_sda-tpool
│                                           253:17   0 452.9G  0 lvm
│   ├─gluster_vg_sda-gluster_thinpool_gluster_vg_sda
│   │                                       253:18   0 452.9G  1 lvm
│   └─gluster_vg_sda-gluster_lv_data        253:19   0   480G  0 lvm   /gluster_bricks/data
└─gluster_vg_sda-gluster_thinpool_gluster_vg_sda_tdata
                                            253:16   0 452.9G  0 lvm
  └─gluster_vg_sda-gluster_thinpool_gluster_vg_sda-tpool
                                            253:17   0 452.9G  0 lvm
    ├─gluster_vg_sda-gluster_thinpool_gluster_vg_sda
    │                                       253:18   0 452.9G  1 lvm
    └─gluster_vg_sda-gluster_lv_data        253:19   0   480G  0 lvm   /gluster_bricks/data
sdb                                           8:16   0 838.4G  0 disk
└─350014ee7aaad2514                         253:5    0 838.4G  0 mpath
sdc                                           8:32   0 838.4G  0 disk
└─350014ee7000283fc                         253:6    0 838.4G  0 mpath
sdd                                           8:48   0 278.9G  0 disk
├─sdd1                                        8:49   0     1G  0 part  /boot
└─sdd2                                        8:50   0 277.9G  0 part
  ├─onn-pool00_tmeta                        253:0    0     1G  0 lvm
  │ └─onn-pool00-tpool                      253:2    0   206G  0 lvm
  │   ├─onn-ovirt--node--ng--4.4.10.2--0.20220303 
锐单商城拥有海量元器件数据手册IC替代型号,打造电子元器件IC百科大全!

相关文章