我有一台 SLES 11.2 PPC (3.0.58-0.6.6-ppc64) 系统,它丢失了卷组(包含 LV,其中的数据并不重要,但最好能找回)。磁盘通过 SAN 的两条光纤路径连接。
问题始于上周五我计划停电前重新启动它时。我没有时间排除故障,就再次将其关闭。该卷组之前已成功使用了大约两年。
vgscan 和 pvscan 没有返回任何内容:
# pvscan -vP
Partial mode. Incomplete logical volumes will be processed.
Wiping cache of LVM-capable devices
Wiping internal VG cache
Walking through all physical volumes
No matching physical volumes found
# vgscan -vP
Partial mode. Incomplete logical volumes will be processed.
Wiping cache of LVM-capable devices
Wiping internal VG cache
Reading all physical volumes. This may take a while...
Finding all volume groups
No volume groups found
vgcfgrestore 报告找不到 PV:
# vgcfgrestore vgclients
Couldn't find device with uuid PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU.
Couldn't find device with uuid FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2.
Cannot restore Volume Group vgclients with 2 PVs marked as missing.
Restore failed.
但是 blkid 可以找到这些 UUID:
# blkid -t UUID=PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU
/dev/mapper/3600a0b800029df24000011084db97741: UUID="PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU" TYPE="LVM2_member"
/dev/sdl: UUID="PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU" TYPE="LVM2_member"
/dev/sdw: UUID="PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU" TYPE="LVM2_member"
# blkid -t UUID=FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2
/dev/mapper/3600a0b800029df24000017ae4f45f30b: UUID="FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2" TYPE="LVM2_member"
/dev/sdg: UUID="FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2" TYPE="LVM2_member"
/dev/sdr: UUID="FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2" TYPE="LVM2_member"
/etc/lvm/backup/vgclients
包含所有正确的信息并且没有说 PV 缺失:
# egrep "(N1YELU|kSqUA2|dm-|ALLOC)" /etc/lvm/backup/vgclients
id = "PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU"
device = "/dev/dm-7" # Hint only
status = ["ALLOCATABLE"]
id = "FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2"
device = "/dev/dm-12" # Hint only
status = ["ALLOCATABLE"]
我在 SAN 上确认了此服务器上 LVM 专用的卷(并已命名)已显示,并且标识符(以 f30b 或 7741 结尾)在 SAN 和服务器上匹配:
# multipath -ll | egrep -A5 "(f30b|7741)"
3600a0b800029df24000017ae4f45f30b dm-7 IBM,1814 FAStT
size=575G features='1 queue_if_no_path' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=6 status=active
| `- 6:0:0:1 sdr 65:16 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 5:0:0:1 sdg 8:96 active ghost running
--
3600a0b800029df24000011084db97741 dm-12 IBM,1814 FAStT
size=834G features='1 queue_if_no_path' hwhandler='1 rdac' wp=rw
|-+- policy='round-robin 0' prio=6 status=active
| `- 5:0:0:7 sdl 8:176 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 6:0:0:7 sdw 65:96 active ghost running
两个设备都没有分区表(根据设计):
# fdisk -l /dev/dm-7 /dev/dm-12 | grep table
Disk /dev/dm-7 doesn't contain a valid partition table
Disk /dev/dm-12 doesn't contain a valid partition table
我可以直接从设备读取:
# dd if=/dev/dm-7 of=/tmp/a bs=1024 count=1
1+0 records in
1+0 records out
1024 bytes (1.0 kB) copied, 0.00121051 s, 846 kB/s
# strings /tmp/a
LABELONE
LVM2 001FXfSAOP9hODgtl0Ihfx2jXTnHUkSqUA2
我尝试过重新启动、删除sd(r|g|l|w)
并dm-(7|12)
重新扫描,但都没有效果。
我尝试使用备份值重新创建 PV,但它仍然说找不到它们。
# pvcreate --uuid "PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU" --restorefile /etc/lvm/backup/vgclients /dev/mapper/3600a0b800029df24000011084db97741 -t
Test mode: Metadata will NOT be updated and volumes will not be (de)activated.
Couldn't find device with uuid PyKfIa-cCs9-gBoh-Qb50-yOw4-dHQw-N1YELU.
Couldn't find device with uuid FXfSAO-P9hO-Dgtl-0Ihf-x2jX-TnHU-kSqUA2.
Device /dev/mapper/3600a0b800029df24000011084db97741 not found (or ignored by filtering).
这是我的 lvm.conf,但据我所知,我所做的唯一更改是增加了日志级别:
# egrep -v "^( *#|$)" /etc/lvm/lvm.conf
devices {
dir = "/dev"
scan = [ "/dev" ]
preferred_names = [ ]
filter = [ "a|^/dev/sda$|", "r/.*/" ]
cache = "/etc/lvm/.cache"
write_cache_state = 1
sysfs_scan = 1
md_component_detection = 1
ignore_suspended_devices = 0
}
log {
verbose = 0
syslog = 1
overwrite = 0
level = 2
indent = 1
command_names = 0
prefix = " "
}
backup {
backup = 1
backup_dir = "/etc/lvm/backup"
archive = 1
archive_dir = "/etc/lvm/archive"
retain_min = 10
retain_days = 30
}
shell {
history_size = 100
}
global {
umask = 077
test = 0
units = "h"
activation = 1
proc = "/proc"
locking_type = 3
fallback_to_clustered_locking = 1
fallback_to_local_locking = 1
locking_dir = "/var/run/lvm/lock"
}
activation {
missing_stripe_filler = "/dev/ioerror"
reserved_stack = 256
reserved_memory = 8192
process_priority = -18
mirror_region_size = 512
readahead = "auto"
mirror_log_fault_policy = "allocate"
mirror_device_fault_policy = "remove"
udev_rules = 1
udev_sync = 1
}
dmeventd {
mirror_library = "libdevmapper-event-lvm2mirror.so"
snapshot_library = "libdevmapper-event-lvm2snapshot.so"
}
那么到底是怎么回事?我的 VG 去哪了?我该如何找回它?
答案1
Novell 知识库中的一份文档似乎适用于此:它解释了在 SLES 上,LVM 默认不会扫描多路径设备,因此在这种情况下永远不会看到它们。
为了解决该问题,您可以实施 Novell 提供的解决方法:
在/etc/lvm.conf
部分中devices
,将 更改filter
为:
filter = [ "a|/dev/sda.*|", "a|/dev/disk/by-id/dm-uuid-.*mpath-.*|", "r|.*|"]
(这适用于 SLES 11。对于其他版本,请参阅链接的 KB 文章。)
答案2
当我遇到同样的问题时,vgreduce --removemissing 对我有帮助。
这就是我创建这个问题的方式。
我本来要扩展现有的逻辑卷,但中途我从另一个终端对将要用于扩展的设备运行了 fdisk。它有一些我打算删除的先前分区表。由于我已经将此磁盘添加到卷组(只是尚未扩展逻辑卷本身),但该物理卷不再存在,因此发生了缺少 UUID 的问题。
为了解决这个问题,我使用 vgreduce --removemissing 然后就好了。
答案3
修改/etc/lvm/backup/<vg_name>
文件。修复混乱的内容,特别是删除缺失的 UUID。
然后执行:
vgcfgrestore <vg_name>