美文网首页wencentos
【LVM】LVM元数据丢失恢复

【LVM】LVM元数据丢失恢复

作者: Bogon | 来源:发表于2023-10-09 21:51 被阅读0次
    # yum -y install  lvm2
    
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.cloud.aliyuncs.com
     * extras: mirrors.cloud.aliyuncs.com
     * updates: mirrors.cloud.aliyuncs.com
    Package 7:lvm2-2.02.187-6.el7_9.5.x86_64 already installed and latest version
    
    
    # yum info lvm2
    
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * base: mirrors.cloud.aliyuncs.com
     * extras: mirrors.cloud.aliyuncs.com
     * updates: mirrors.cloud.aliyuncs.com
    Installed Packages
    Name        : lvm2
    Arch        : x86_64
    Epoch       : 7
    Version     : 2.02.187
    Release     : 6.el7_9.5
    Size        : 3.0 M
    Repo        : installed
    From repo   : updates
    Summary     : Userland logical volume management tools
    URL         : http://sources.redhat.com/lvm2
    License     : GPLv2
    Description : LVM2 includes all of the support for handling read/write operations on
                : physical volumes (hard disks, RAID-Systems, magneto optical, etc.,
                : multiple devices (MD), see mdadm(8) or even loop devices, see
                : losetup(8)), creating volume groups (kind of virtual disks) from one
                : or more physical volumes and creating one or more logical volumes
                : (kind of logical partitions) in volume groups.
    
    
    # rpm -ql  lvm2 | grep -v share
    
    /etc/lvm
    /etc/lvm/archive
    /etc/lvm/backup
    /etc/lvm/cache
    /etc/lvm/cache/.cache
    /etc/lvm/lvm.conf
    /etc/lvm/lvmlocal.conf
    /etc/lvm/profile
    /etc/lvm/profile/cache-mq.profile
    /etc/lvm/profile/cache-smq.profile
    /etc/lvm/profile/command_profile_template.profile
    /etc/lvm/profile/lvmdbusd.profile
    /etc/lvm/profile/metadata_profile_template.profile
    /etc/lvm/profile/thin-generic.profile
    /etc/lvm/profile/thin-performance.profile
    /run/lock/lvm
    /run/lvm
    /usr/lib/systemd/system-generators/lvm2-activation-generator
    /usr/lib/systemd/system/lvm2-lvmetad.service
    /usr/lib/systemd/system/lvm2-lvmetad.socket
    /usr/lib/systemd/system/lvm2-lvmpolld.service
    /usr/lib/systemd/system/lvm2-lvmpolld.socket
    /usr/lib/systemd/system/lvm2-monitor.service
    /usr/lib/systemd/system/lvm2-pvscan@.service
    /usr/lib/tmpfiles.d/lvm2.conf
    /usr/lib/udev/rules.d/11-dm-lvm.rules
    /usr/lib/udev/rules.d/69-dm-lvm-metad.rules
    /usr/sbin/fsadm
    /usr/sbin/lvchange
    /usr/sbin/lvconvert
    /usr/sbin/lvcreate
    /usr/sbin/lvdisplay
    /usr/sbin/lvextend
    /usr/sbin/lvm
    /usr/sbin/lvmconf
    /usr/sbin/lvmconfig
    /usr/sbin/lvmdiskscan
    /usr/sbin/lvmdump
    /usr/sbin/lvmetad
    /usr/sbin/lvmpolld
    /usr/sbin/lvmsadc
    /usr/sbin/lvmsar
    /usr/sbin/lvreduce
    /usr/sbin/lvremove
    /usr/sbin/lvrename
    /usr/sbin/lvresize
    /usr/sbin/lvs
    /usr/sbin/lvscan
    /usr/sbin/pvchange
    /usr/sbin/pvck
    /usr/sbin/pvcreate
    /usr/sbin/pvdisplay
    /usr/sbin/pvmove
    /usr/sbin/pvremove
    /usr/sbin/pvresize
    /usr/sbin/pvs
    /usr/sbin/pvscan
    /usr/sbin/vgcfgbackup
    /usr/sbin/vgcfgrestore
    /usr/sbin/vgchange
    /usr/sbin/vgck
    /usr/sbin/vgconvert
    /usr/sbin/vgcreate
    /usr/sbin/vgdisplay
    /usr/sbin/vgexport
    /usr/sbin/vgextend
    /usr/sbin/vgimport
    /usr/sbin/vgimportclone
    /usr/sbin/vgmerge
    /usr/sbin/vgmknodes
    /usr/sbin/vgreduce
    /usr/sbin/vgremove
    /usr/sbin/vgrename
    /usr/sbin/vgs
    /usr/sbin/vgscan
    /usr/sbin/vgsplit
    
    # rpm -ql  lvm2 | grep -v share | grep system
    
    /usr/lib/systemd/system-generators/lvm2-activation-generator
    /usr/lib/systemd/system/lvm2-lvmetad.service
    /usr/lib/systemd/system/lvm2-lvmetad.socket
    /usr/lib/systemd/system/lvm2-lvmpolld.service
    /usr/lib/systemd/system/lvm2-lvmpolld.socket
    /usr/lib/systemd/system/lvm2-monitor.service
    /usr/lib/systemd/system/lvm2-pvscan@.service
    
    
    # systemctl status  lvm2-lvmetad.service
    ● lvm2-lvmetad.service - LVM2 metadata daemon
       Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmetad.service; static; vendor preset: enabled)
       Active: active (running) since Wed 2023-01-04 17:15:31 CST; 9 months 5 days ago
         Docs: man:lvmetad(8)
     Main PID: 10479 (lvmetad)
       CGroup: /system.slice/lvm2-lvmetad.service
               └─10479 /usr/sbin/lvmetad -f
    
    Jan 04 17:15:31 bogon systemd[1]: Started LVM2 metadata daemon.
    
    
    # cat /usr/lib/systemd/system/lvm2-lvmetad.service
    
    [Unit]
    Description=LVM2 metadata daemon
    Documentation=man:lvmetad(8)
    Requires=lvm2-lvmetad.socket
    Before=shutdown.target
    After=lvm2-lvmetad.socket
    DefaultDependencies=no
    Conflicts=shutdown.target
    
    [Service]
    Type=simple
    NonBlocking=true
    ExecStart=/usr/sbin/lvmetad -f
    Environment=SD_ACTIVATION=1
    Restart=on-abort
    PIDFile=/run/lvmetad.pid
    
    # systemctl status lvm2-lvmetad.socket
    ● lvm2-lvmetad.socket - LVM2 metadata daemon socket
       Loaded: loaded (/usr/lib/systemd/system/lvm2-lvmetad.socket; enabled; vendor preset: enabled)
       Active: active (running) since Wed 2023-01-04 17:15:31 CST; 9 months 5 days ago
         Docs: man:lvmetad(8)
       Listen: /run/lvm/lvmetad.socket (Stream)
    
    
    # cat /usr/lib/systemd/system/lvm2-lvmetad.socket
    [Unit]
    Description=LVM2 metadata daemon socket
    Documentation=man:lvmetad(8)
    DefaultDependencies=no
    Conflicts=shutdown.target
    
    [Socket]
    ListenStream=/run/lvm/lvmetad.socket
    SocketMode=0600
    RemoveOnStop=true
    
    [Install]
    WantedBy=sysinit.target
    
    

    参考

    重启机器导致LVM莫名丢失
    https://mp.weixin.qq.com/s/ytuuZXFT5ccY9nE8cdEzNw

    记一次LVM元数据丢失的恢复过程
    https://mp.weixin.qq.com/s/8dVRPWI_5G8LWL1XqorTvA

    5 easy steps to recover LVM2 partition, PV, VG, LVM metdata in Linux
    https://www.golinuxcloud.com/recover-lvm2-partition-restore-vg-pv-metadata

    LVM恢复技术案例
    https://www.cnblogs.com/zcyy/articles/16834848.html

    (LVM) Cannot restore Volume Group with 1 PVs marked as missing. Couldn't find device with uuid, but the pv exists and blkid finds the same uuid
    https://serverfault.com/questions/1016772/lvm-cannot-restore-volume-group-with-1-pvs-marked-as-missing-couldnt-find-de

    相关文章

      网友评论

        本文标题:【LVM】LVM元数据丢失恢复

        本文链接:https://www.haomeiwen.com/subject/khxwbdtx.html