修复丢失的pv

阅读: 评论:0

修复丢失的pv

修复丢失的pv

在给RHEL进行扩容的时候提示有个lv找不到了。应该是分配给交换空间的lv找不到了,导致没法进行库容。下面是处理过程。

提示缺少一个pv导致无法继续


## 初始报错
[root@localhost ~]# pvdisplay/dev/rhel/swap: read failed after 0 of 4096 at 4294901760: 输入/输出错误/dev/rhel/swap: read failed after 0 of 4096 at 4294959104: 输入/输出错误WARNING: Device for PV iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE not found or rejected by a filter.--- Physical volume ---PV Name               /dev/sda2VG Name               rhelPV Size               19.51 GiB / not usable 3.00 MiBAllocatable           yes (but full)PE Size               4.00 MiBTotal PE              4994Free PE               0Allocated PE          4994PV UUID               81PW3j-W2eg-19qX-27NN-e1zr-750q-7u5ZIy--- Physical volume ---PV Name               unknown deviceVG Name               rhelPV Size               2.00 GiB / not usable 4.00 MiBAllocatable           yes PE Size               4.00 MiBTotal PE              511Free PE               9Allocated PE          502PV UUID               iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE--- Physical volume ---PV Name               /dev/sda3VG Name               rhelPV Size               10.00 GiB / not usable 4.00 MiBAllocatable           yes PE Size               4.00 MiBTotal PE              2559Free PE               2559Allocated PE          0PV UUID               UVulsk-WJ3R-y7ga-EYT7-dfd8-26hY-sUucWK# 扩容分区报错
[root@localhost ~]# lvextend -L +10236m /dev/mapper/rhel-rootWARNING: Device for PV iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE not found or rejected by a filter.Cannot change VG rhel while PVs are missing.Consider vgreduce --removemissing.# 提示某个pv丢失了  
[root@localhost ~]# pvs/dev/rhel/swap: read failed after 0 of 4096 at 4294901760: 输入/输出错误/dev/rhel/swap: read failed after 0 of 4096 at 4294959104: 输入/输出错误WARNING: Device for PV iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE not found or rejected by a filter.PV             VG   Fmt  Attr PSize  PFree /dev/sda2      rhel lvm2 a--  19.51g     0 /dev/sda3      rhel lvm2 a--  10.00g 10.00gunknown device rhel lvm2 a-m   2.00g 36.00m

添加一个磁盘

[root@localhost ~]# fdisk /dev/sdb
欢迎使用 fdisk (util-linux 2.23.2)。更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。Device does not contain a recognized partition table
使用磁盘标识符 0x14e3066c 创建新的 DOS 磁盘标签。命令(输入 m 获取帮助):m
命令操作a   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partitiong   create a new empty GPT partition tableG   create an IRIX (SGI) partition tablel   list known partition typesm   print this menun   add a new partitiono   create a new empty DOS partition tablep   print the partition tableq   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)命令(输入 m 获取帮助):n
Partition type:p   primary (0 primary, 0 extended, 4 free)e   extended
Select (default p): p
分区号 (1-4,默认 1):
起始 扇区 (2048-8388607,默认为 2048):
将使用默认值 2048
Last 扇区, +扇区 or +size{K,M,G} (2048-8388607,默认为 8388607):
将使用默认值 8388607
分区 1 已设置为 Linux 类型,大小设为 4 GiB命令(输入 m 获取帮助):m
命令操作a   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partitiong   create a new empty GPT partition tableG   create an IRIX (SGI) partition tablel   list known partition typesm   print this menun   add a new partitiono   create a new empty DOS partition tablep   print the partition tableq   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)命令(输入 m 获取帮助):t
已选择分区 1
Hex 代码(输入 L 列出所有代码):L0  空              24  NEC DOS         81  Minix / 旧 Linu bf  Solaris        1  FAT12           27  隐藏的 NTFS Win 82  Linux 交换 / So c1  DRDOS/sec (FAT-2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-3  XENIX usr       3c  PartitionMagic  84  OS/2 隐藏的 C:  c6  DRDOS/sec (FAT-4  FAT16 <32M      40  Venix 80286     85  Linux 扩展      c7  Syrinx         5  扩展            41  PPC PReP Boot   86  NTFS 卷集       da  非文件系统数据 6  FAT16           42  SFS             87  NTFS 卷集       db  CP/M / CTOS / .7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux 纯文本    de  Dell 工具      8  AIX             4e  QNX4.x 第2部分  8e  Linux LVM       df  BootIt         9  AIX 可启动      4f  QNX4.x 第3部分  93  Amoeba          e1  DOS 访问       a  OS/2 启动管理器 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad 休 eb  BeOS fs        e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            f  W95 扩展 (LBA)  54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12/16/
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux/PA-RISC  
11  隐藏的 FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      
12  Compaq 诊断     5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      
14  隐藏的 FAT16 <3 61  SpeedStor       ab  Darwin 启动     f2  DOS 次要       
16  隐藏的 FAT16    63  GNU HURD or Sys af  HFS / HFS+      fb  VMware VMFS    
17  隐藏的 HPFS/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE 
18  AST 智能睡眠    65  Novell Netware  b8  BSDI swap       fd  Linux raid 自动
1b  隐藏的 W95 FAT3 70  DiskSecure 多启 bb  Boot Wizard 隐  fe  LANstep        
1c  隐藏的 W95 FAT3 75  PC/IX           be  Solaris 启动    ff  BBT            
1e  隐藏的 W95 FAT1 80  旧 Minix       
Hex 代码(输入 L 列出所有代码):8e
已将分区“Linux”的类型更改为“Linux LVM”命令(输入 m 获取帮助):m
命令操作a   toggle a bootable flagb   edit bsd disklabelc   toggle the dos compatibility flagd   delete a partitiong   create a new empty GPT partition tableG   create an IRIX (SGI) partition tablel   list known partition typesm   print this menun   add a new partitiono   create a new empty DOS partition tablep   print the partition tableq   quit without saving changess   create a new empty Sun disklabelt   change a partition's system idu   change display/entry unitsv   verify the partition tablew   write table to disk and exitx   extra functionality (experts only)命令(输入 m 获取帮助):w
The partition table has been altered!Calling ioctl() to re-read partition table.
正在同步磁盘。
[root@localhost ~]# fdisk -l磁盘 /dev/sda:32.2 GB, 32212254720 字节,62914560 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x00049ebe设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048    41943039    20458496   8e  Linux LVM
/dev/sda3        41943040    62914559    10485760   8e  Linux LVM磁盘 /dev/sdb:4294 MB, 4294967296 字节,8388608 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x14e3066c设备 Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048     8388607     4193280   8e  Linux LVM磁盘 /dev/mapper/rhel-root:18.8 GB, 18756927488 字节,36634624 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节fdisk: 打不开 /dev/mapper/rhel-swap-missing_2_0: 输入/输出错误[root@localhost ~]# 4 /dev/sdb1 
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
262144 inodes, 1048320 blocks
52416 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=1073741824
32 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks: 32768, 98304, 163840, 229376, 294912, 819200, 884736Allocating group tables: 完成                            
正在写入inode表: 完成                            
Creating journal (16384 blocks): 完成
Writing superblocks and filesystem accounting information: 完成 [root@localhost ~]# pvs/dev/rhel/swap: read failed after 0 of 4096 at 4294901760: 输入/输出错误/dev/rhel/swap: read failed after 0 of 4096 at 4294959104: 输入/输出错误WARNING: Device for PV iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE not found or rejected by a filter.PV             VG   Fmt  Attr PSize  PFree /dev/sda2      rhel lvm2 a--  19.51g     0 /dev/sda3      rhel lvm2 a--  10.00g 10.00gunknown device rhel lvm2 a-m   2.00g 36.00m

将新创建的pv管理到丢失的pv上

[root@localhost ~]# pvcreate --helppvcreate: Initialize physical volume(s) for use by LVMpvcreate[--norestorefile][--restorefile file][--commandprofile ProfileName][-d|--debug][-f[f]|--force [--force]][-h|-?|--help][--labelsector sector][-M|--metadatatype 1|2][--pvmetadatacopies #copies][--bootloaderareasize BootLoaderAreaSize[bBsSkKmMgGtTpPeE]][--metadatasize MetadataSize[bBsSkKmMgGtTpPeE]][--dataalignment Alignment[bBsSkKmMgGtTpPeE]][--dataalignmentoffset AlignmentOffset[bBsSkKmMgGtTpPeE]][--setphysicalvolumesize PhysicalVolumeSize[bBsSkKmMgGtTpPeE][-t|--test][-u|--uuid uuid][-v|--verbose][-y|--yes][-Z|--zero {y|n}][--version]PhysicalVolume [][root@localhost ~]# pvcreate /dev/sdb1 --u iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE --norestorefileWARNING: Device for PV iUJdjw-C9S6-bRE7-jIdl-6kQ6-esLL-5vDGYE not found or rejected by a filter.
WARNING: ext4 signature detected on /dev/sdb1 at offset 1080. Wipe it? [y/n]: yWiping ext4 signature on /dev/sdb1.Physical volume "/dev/sdb1" successfully created
[root@localhost ~]# pvs/dev/rhel/swap: read failed after 0 of 4096 at 4294901760: 输入/输出错误/dev/rhel/swap: read failed after 0 of 4096 at 4294959104: 输入/输出错误PV         VG   Fmt  Attr PSize  PFree /dev/sda2  rhel lvm2 a--  19.51g     0 /dev/sda3  rhel lvm2 a--  10.00g 10.00g/dev/sdb1  rhel lvm2 a-m   2.00g 36.00m

依旧报错

[root@localhost ~]# lvextend -L +10236m /dev/rhel/rootMissing device /dev/sdb1 reappeared, updating metadata for VG rhel to version 7.Device still marked missing because of allocated data on it, remove volumes and consider vgreduce --removemissing.Cannot change VG rhel while PVs are missing.Consider vgreduce --removemissing.

强制移除丢失的lv

[root@localhost ~]# vgreduce --removemissing rhelWARNING: Partial LV swap needs to be repaired or removed. There are still partial LVs in VG rhel.To remove them unconditionally use: vgreduce --removemissing --force.Proceeding to remove empty missing PVs.
[root@localhost ~]# vgreduce --removemissing rhel --forceRemoving partial LV swap.Logical volume rhel/swap in use.[root@localhost ~]# vgscanReading all physical volumes.  This may take Found volume group "rhel" using metadata type lvm2
[root@localhost ~]#  vgchange -a y Refusing activation of partial LV rhel/swap.  Use '--activationmode partial' to override.2 logical volume(s) in volume group "rhel" now active

关闭交换空间

  [root@localhost ~]# lvs LV   VG   Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convertroot rhel -wi-ao---- 17.47g                                                    swap rhel -wi-ao--p-  4.00g                                                    
[root@localhost ~]# swapoff -v /dev/rhel/swap
swapoff /dev/rhel/swap
[root@localhost ~]# vgreduce --removemissing rhelWARNING: Partial LV swap needs to be repaired or removed. There are still partial LVs in VG rhel.To remove them unconditionally use: vgreduce --removemissing --force.Proceeding to remove empty missing PVs.
[root@localhost ~]# vgreduce --removemissing rhel --forceRemoving partial LV swap.Logical volume "swap" successfully removedWrote out consistent volume group rhel

这次允许扩容了

  [root@localhost ~]# lvextend -L +10236m /dev/rhel/rootSize of logical volume rhel/root changed from 17.47 GiB (4472 extents) to 27.46 GiB (7031 extents).Logical volume root successfully resized.

参考文章:
/

本文发布于:2024-02-01 14:09:11,感谢您对本站的认可!

本文链接:https://www.4u4v.net/it/170676775137147.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:pv
留言与评论(共有 0 条评论)
   
验证码:

Copyright ©2019-2022 Comsenz Inc.Powered by ©

网站地图1 网站地图2 网站地图3 网站地图4 网站地图5 网站地图6 网站地图7 网站地图8 网站地图9 网站地图10 网站地图11 网站地图12 网站地图13 网站地图14 网站地图15 网站地图16 网站地图17 网站地图18 网站地图19 网站地图20 网站地图21 网站地图22/a> 网站地图23