Linux中LVM磁盘更换操作不当导致的错误及修复过程记录
今天备份服务器(8.77)在替换磁盘时,新磁盘的加入和应用路径更改都很正常,但在将原磁盘从vg中删除时,由于操作失误,导致vg无法认出,以下是问题过程和解决方法:
在执行pvremove -ff /dev/sdg命令后,vg出现异常,无论vgdisplay、lvdisplay还是pvdisplay,都出现如下提示
[root@backupserver data]# vgdisplay
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Couldn't find device with uuid 'q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ'.
Couldn't find all physical volumes for volume group stuvg.
Volume group "stuvg" not found
说明这个pv的信息还存在vg中,但这是pv没有了,vg信息不完整,仔细分析lvm的工作原理,又在网上查资料后,操作如下:
[root@backupserver archive]# vgdisplay --partial -vvv #查看vg中的详细信息 如果此信息中其他pv和lv的信息完整,则继续操作
linux磁盘管理 Partial mode. Incomplete volume groups will be activated read-only.
Processing: vgdisplay --partial -vvv
O_DIRECT will be used
Setting global/locking_type to 1
File-based locking selected.
Setting global/locking_dir to /var/lock/lvm
Finding all volume groups
/dev/ramdisk: Not using O_DIRECT
Opened /dev/ramdisk RO
/dev/ramdisk: block size is 1024 bytes
/dev/ramdisk: No label detected
Closed /dev/ramdisk
Opened /dev/root RO O_DIRECT
/dev/root: block size is 4096 bytes
/dev/root: No label detected
Closed /dev/root
/dev/ram: Not using O_DIRECT
……
……
PV Name unknown device
PV UUID q2aKwA-0pim-QRr3-4DjN-gZg9-RNk1-eHKMvZ
PV Status allocatable
Total PE / Free PE 524287 / 524287
……
……
可以看到,被删除的磁盘pvname变成了 unknown device
#cd /etc/lvm/backup #进入lvm的配置目录,查看当前vg配置信息是否正确(删除pv后的)
[root@backupserver backup]# file stuvg
stuvg: ASCII text
[root@backupserver backup]# more stuvg
# Generated by LVM2 version 2.02.37-RHEL4 (2008-06-06): Mon Jul 4 09:14:14 2011
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing 'lvremove /dev/stuvg/lv5'"
creation_host = "backupserver" # Linux backupserver 2.6.9-78.ELlargesmp #1 SMP Wed Jul 9 16:03:59 EDT 2008 x86_64
creation_time = 1309742054 # Mon Jul 4 09:14:14 2011
stuvg {
id = "Z1XN1H-hYFy-xyBM-YXn1-cbCX-r4Vp-Q9dmzj"
seqno = 27
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
physical_volumes {
pv0 {
id = "zzddO6-dz5q-PRq3-8cQe-Vlc8-13M5-SlqAvB"
device = "/dev/sdc" # Hint only
status = ["ALLOCATABLE"]
dev_size = 4294967296 # 2 Terabytes
pe_start = 384
pe_count = 524287 # 2 Terabytes
}
pv1 {
id = "v7VEQp-rSLW-hnSp-hlVd-cllB-r4pt-38W921"
device = "/dev/sdd" # Hint only
status = ["ALLOCATABLE"]
dev_size = 4294967296 # 2 Terabytes
pe_start = 384
pe_count = 524287 # 2 Terabytes
}
pv2 {
id = "h4Wvte-qMC0-1sNc-fJfV-390A-tqrd-f743xY"
device = "/dev/sde" # Hint only
status = ["ALLOCATABLE"]
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论