Centos6操作系统之消失的LVM

Centos6操作系统之消失的LVM

𝓓𝓸𝓷 Lv6

https://docs.redhat.com/zh-cn/documentation/red_hat_enterprise_linux/7/html/logical_volume_manager_administration/cluster_activation

Centos6版本多路径与LVM同时使用时,会出现重启服务器后,逻辑卷消失问题,具体表现为reboot服务器后/dev/mapper/下的LV(vg_vocr-ocr1)没有了,Centos7版本没有这样的问题。

一、现象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
[root@gdyfdb01 ~]# ll /dev/mapper/
total 0
crw-rw---- 1 root root 10, 58 Jan 20 12:41 control
lrwxrwxrwx 1 root root 7 Jan 20 12:41 vg_gdyfdb01-LogVol00 -> ../dm-1
lrwxrwxrwx 1 root root 7 Jan 20 12:41 vg_gdyfdb01-LogVol01 -> ../dm-0
lrwxrwxrwx 1 root root 7 Jan 20 12:41 vg_vocr-ocr1 -> ../dm-3
lrwxrwxrwx 1 root root 7 Jan 20 12:41 vocr -> ../dm-2

[root@gdyfdb01 ~]# sync

[root@gdyfdb01 ~]# reboot

[root@gdyfdb01 ~]# fdisk -l

Disk /dev/sda: 53.7 GB, 53687091200 bytes
64 heads, 32 sectors/track, 51200 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000d1a06

Device Boot Start End Blocks Id System
/dev/sda1 * 2 301 307200 83 Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2 302 51200 52120576 8e Linux LVM
Partition 2 does not end on cylinder boundary.

Disk /dev/mapper/vg_gdyfdb01-LogVol01: 44.8 GB, 44778389504 bytes
255 heads, 63 sectors/track, 5443 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_gdyfdb01-LogVol00: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/sdb: 6442 MB, 6442516480 bytes
199 heads, 62 sectors/track, 1019 cylinders
Units = cylinders of 12338 * 512 = 6317056 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disk identifier: 0x00000000


Disk /dev/sdc: 6442 MB, 6442516480 bytes
199 heads, 62 sectors/track, 1019 cylinders
Units = cylinders of 12338 * 512 = 6317056 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vocr: 6442 MB, 6442516480 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/vg_vocr-ocr1: 1073 MB, 1073741824 bytes
255 heads, 63 sectors/track, 130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 65536 bytes
I/O size (minimum/optimal): 65536 bytes / 65536 bytes
Disk identifier: 0x00000000


[root@gdyfdb01 ~]# multipath -ll
vocr (36589cfc000000449ab518525193bae47) dm-2 TrueNAS,iSCSI Disk
size=6.0G features='0' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=1 status=active
| `- 33:0:0:0 sdb 8:16 active ready running
`-+- policy='round-robin 0' prio=1 status=enabled
`- 34:0:0:0 sdc 8:32 active ready running
[root@gdyfdb01 ~]#
[root@gdyfdb01 ~]# more /etc/multipath.conf
## Use user friendly names, instead of using WWIDs as names.
defaults {
user_friendly_names yes
}
blacklist {
devnode "^(ram|raw|loop|fd|md|dm-|sr|scd|st)[0-9]*"
devnode "^(hd|xvd|vd)[a-z]*"
# wwid "*"
}

multipaths {
multipath {
wwid 36589cfc000000449ab518525193bae47
alias vocr
}
}

[root@gdyfdb01 ~]# ll /dev/mapper/
total 0
crw-rw---- 1 root root 10, 58 Jan 20 12:41 control
lrwxrwxrwx 1 root root 7 Jan 20 12:41 vg_gdyfdb01-LogVol00 -> ../dm-1
lrwxrwxrwx 1 root root 7 Jan 20 12:41 vg_gdyfdb01-LogVol01 -> ../dm-0

此处逻辑卷vg_vocr-ocr1 -> ../dm-3 丢失了。

二、原因

原因未知

三、解决方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
(1) 手工激活卷组
[root@gdyfdb01 ~]# ll /dev/mapper/
total 0
crw-rw---- 1 root root 10, 58 Jan 20 12:34 control
lrwxrwxrwx 1 root root 7 Jan 20 12:34 vg_gdyfdb01-LogVol00 -> ../dm-1
lrwxrwxrwx 1 root root 7 Jan 20 12:34 vg_gdyfdb01-LogVol01 -> ../dm-0
lrwxrwxrwx 1 root root 7 Jan 20 12:34 vocr -> ../dm-2

[root@gdyfdb01 ~]# lvscan
inactive '/dev/vg_vocr/ocr1' [1.00 GiB] inherit
ACTIVE '/dev/vg_gdyfdb01/LogVol01' [41.70 GiB] inherit
ACTIVE '/dev/vg_gdyfdb01/LogVol00' [8.00 GiB] inherit

[root@gdyfdb01 ~]# lvdisplay /dev/vg_vocr/ocr1
--- Logical volume ---
LV Path /dev/vg_vocr/ocr1
LV Name ocr1
VG Name vg_vocr
LV UUID 3h8Bmb-46Uf-M1r4-6M00-RcR3-iilw-UejiyH
LV Write Access read/write
LV Creation host, time gdyfdb01, 2026-01-20 12:23:53 +0800
LV Status NOT available
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto

检查发现逻辑卷状态NOT available

[root@gdyfdb01 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 3.7G 0 rom
sda 8:0 0 50G 0 disk
├─sda1 8:1 0 300M 0 part /boot
└─sda2 8:2 0 49.7G 0 part
├─vg_gdyfdb01-LogVol01 (dm-0) 253:0 0 41.7G 0 lvm /
└─vg_gdyfdb01-LogVol00 (dm-1) 253:1 0 8G 0 lvm [SWAP]
sdb 8:16 0 6G 0 disk
└─vocr (dm-2) 253:2 0 6G 0 mpath
sdc 8:32 0 6G 0 disk
└─vocr (dm-2) 253:2 0 6G 0 mpath

[root@gdyfdb01 ~]# vgchange -a y vg_vocr
1 logical volume(s) in volume group "vg_vocr" now active

[root@gdyfdb01 ~]# ll /dev/mapper/
total 0
crw-rw---- 1 root root 10, 58 Jan 20 12:34 control
lrwxrwxrwx 1 root root 7 Jan 20 12:34 vg_gdyfdb01-LogVol00 -> ../dm-1
lrwxrwxrwx 1 root root 7 Jan 20 12:34 vg_gdyfdb01-LogVol01 -> ../dm-0
lrwxrwxrwx 1 root root 7 Jan 20 12:35 vg_vocr-ocr1 -> ../dm-3
lrwxrwxrwx 1 root root 7 Jan 20 12:34 vocr -> ../dm-2

[root@gdyfdb01 ~]# lvdisplay
--- Logical volume ---
LV Path /dev/vg_vocr/ocr1
LV Name ocr1
VG Name vg_vocr
LV UUID 3h8Bmb-46Uf-M1r4-6M00-RcR3-iilw-UejiyH
LV Write Access read/write
LV Creation host, time gdyfdb01, 2026-01-20 12:23:53 +0800
LV Status available
# open 0
LV Size 1.00 GiB
Current LE 256
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:3

--- Logical volume ---
LV Path /dev/vg_gdyfdb01/LogVol01
LV Name LogVol01
VG Name vg_gdyfdb01
LV UUID qzuphP-ewbm-3X17-ald5-yHJf-594T-KVRhBs
LV Write Access read/write
LV Creation host, time gdyfdb01, 2026-01-19 02:35:28 +0800
LV Status available
# open 1
LV Size 41.70 GiB
Current LE 10676
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:0

--- Logical volume ---
LV Path /dev/vg_gdyfdb01/LogVol00
LV Name LogVol00
VG Name vg_gdyfdb01
LV UUID f3NPq3-yTTk-kfYV-gqhL-AyFt-dciZ-6sJWDi
LV Write Access read/write
LV Creation host, time gdyfdb01, 2026-01-19 02:35:33 +0800
LV Status available
# open 1
LV Size 8.00 GiB
Current LE 2048
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 256
Block device 253:1

(2) 将激活卷组命令写进开机自动启动中
[root@gdyfdb01 ~]# vi /etc/rc.local

vgchange -a y vg_vocr
  • Title: Centos6操作系统之消失的LVM
  • Author: 𝓓𝓸𝓷
  • Created at : 2026-01-20 16:19:25
  • Updated at : 2026-01-20 16:20:09
  • Link: https://www.zhangdong.me/centos-multipath-lvm.html
  • License: This work is licensed under CC BY-NC-SA 4.0.
评论