zoukankan      html  css  js  c++  java
  • 日常工作问题解决:记一次centos7上的lvm表错误解决过程

    问题描述: 公司大数据hadoop2服务器采用电信云服务器,后来故障,电信恢复该服务器,需要重新部署程序,需要扩展lvm分区,但是使用pvsan命令发现有报错信息,需要解决以防重启后,因挂载问题,无法启动

    故障之前:该机器是作为大数据服务器2,和其他3台大数据服务器配置一样,都挂载有2块硬盘,vda和vdb.
    其中vda500g,vdb10T。作为均作为lvm使用,vda有5个分区,其中 vda2,vda3,vda5、vdb都作为pv,加入到名为centos的vg中,lvm表和分区表如下所示:

    
    [root@hadoop1 ~]# fdisk -l /dev/vda
    
    Disk /dev/vda: 536.9 GB, 536870912000 bytes, 1048576000 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 label type: dos
    Disk identifier: 0x000c27c8
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1            2048     1026047      512000   83  Linux
    /dev/vda2         1028096   105885695    52428800   83  Linux
    /dev/vda3       105886718  1015935546   455024414+  83  Linux
    /dev/vda4      1015937024  1048575999    16319488    f  W95 Ext'd (LBA)
    /dev/vda5      1015939072  1048575999    16318464   83  Linux
    [root@hadoop1 ~]# fdisk -l /dev/vdb
    
    Disk /dev/vdb: 10737.4 GB, 10737418240000 bytes, 20971520000 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
    [root@hadoop1 ~]# vgs
      VG     #PV #LV #SN Attr   VSize  VFree
      centos   4   3   0 wz--n- 10.25t    0 
    [root@hadoop1 ~]# lvs
      LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      home centos -wi-ao----  2.38t                                                    
      root centos -wi-ao----  7.86t                                                    
      swap centos -wi-ao---- 15.50g                                                    
    [root@hadoop1 ~]# vgs
      VG     #PV #LV #SN Attr   VSize  VFree
      centos   4   3   0 wz--n- 10.25t    0 
    [root@hadoop1 ~]# lvs
      LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      home centos -wi-ao----  2.38t                                                    
      root centos -wi-ao----  7.86t                                                    
      swap centos -wi-ao---- 15.50g 
    
    

    但是在hadoop2电信恢复之后,发现vda硬盘变小为100g,同时只有2个分区vda1、vda2,实际只有vda2、vdb作为pv加入到centos的vg组中,但是原先的lvm表并没有变,而在所以导致报错。如下所示:

    
    [root@hadoop2 ~]# fdisk -l
    
    Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos
    Disk identifier: 0x0003b4ac
    
       Device Boot      Start         End      Blocks   Id  System
    /dev/vda1   *        2048     1026047      512000   83  Linux
    /dev/vda2         1026048   209715199   104344576   8e  Linux LVM
    
    Disk /dev/vdb: 10737.4 GB, 10737418240000 bytes, 20971520000 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
    
    

    因为是新建的系统,并没有业务数据,所以解决起来就比较容易。(如果是生产环境,操作之前做好数据备份)

    vgreduce --removemissing --force centos 强制删除vg组centos中错误的pv信息

    vgscan --partial 修复vg信息表
    lvscan --partial 修复lv信息表

    然后重启服务器

    然后发现lvm表信息已经正常

    
    [root@hadoop2 ~]# pvs
      PV         VG     Fmt  Attr PSize  PFree  
      /dev/vda2  centos lvm2 a--  99.51g      0 
      /dev/vdb   centos lvm2 a--   9.77t 100.06g
    
    

    然后依步骤完成lvm系统的扩容挂载即可

  • 相关阅读:
    Office相关
    Eclipse常用设置
    Google logos 纪念电吉他大师莱斯·保罗(LesPaul)演示
    强烈推荐SQL Prompt 3.8,并发布SQL Prompt 3.8 ,SQL Refator 的xxx
    C#命令行编辑器csc.exe
    JSP中文乱码问题 页面经过过滤器后得到的是中文,但插入到MYSQL数据库却成了“?”为什么?
    (转贴)来谈谈SQL数据库中"简单的"SELECT TOP—可能有你从未注意到的细节
    C#Winform限制Textbox只能输入数字
    VPC2007虚拟机与主机的互连互通方法
    邮件会消亡是无稽之谈
  • 原文地址:https://www.cnblogs.com/yj411511/p/11544163.html
Copyright © 2011-2022 走看看