今天工程侧的兄弟反馈一个问题,LVM分区在安装完成重启后发现无法挂载和识别,主机环境为slse11 sp3,通过查看和处理,现在将结果记录下.
一、在线解决
1、通过lvscan查看lv信息,代码如下:
phpfensi.com:~ # lvscan inactive '/dev/vgteas/lvteasdata' [2.72 TiB] inherit
发现lv信息是inactive状态.
2、通过vgchange激活卷组并重启挂载,代码如下:
phpfensi.com:~ # vgchange -a y vgteas
1 logical volume(s) in volume group "vgteas" now active
phpfensi.com:~ # df -hP
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p5 40G 920M 37G 3% /
udev 63G 188K 63G 1% /dev
tmpfs 63G 72K 63G 1% /dev/shm
/dev/cciss/c0d0p1 9.9G 186M 9.2G 2% /boot
/dev/cciss/c0d0p9 38G 9.9G 26G 28% /home
/dev/cciss/c0d0p12 259G 772M 245G 1% /onip/teastore
/dev/cciss/c0d0p11 99G 1.2G 93G 2% /teasredo
phpfensi.com:~ # mount -a
phpfensi.com:~ # df -hP
Filesystem Size Used Avail Use% Mounted on
/dev/cciss/c0d0p5 40G 920M 37G 3% /
udev 63G 188K 63G 1% /dev
tmpfs 63G 72K 63G 1% /dev/shm
/dev/cciss/c0d0p1 9.9G 186M 9.2G 2% /boot
/dev/cciss/c0d0p9 38G 9.9G 26G 28% /home
/dev/cciss/c0d0p12 259G 772M 245G 1% /onip/teastore
/dev/cciss/c0d0p11 99G 1.2G 93G 2% /teasredo
/dev/mapper/vgteas-lvteasdata 2.7T 202M 2.6T 1% /teasdata
发现分区可以重新挂上了.
二、规避方法
(1)设置boot.lvm开机自启动
LVM is "inactive" on first reboot after installation,避免该问题重现,可以从以下两方法如手.
1、查看boot.lvm服务的是否默认随系统load,代码如下:
phpfensi.com:~ # /etc/init.d/boot.lvm status
unknown
phpfensi.com:~ # chkconfig --list|grep lvm
lvm_wait_merge_snapshot 0:off 1:on 2:off 3:off 4:off 5:off 6:off S:on
看到状态是unknow,也就是没有随机启动,这里需要注意的是直接chkconfig --list是无法直接查看到boot.lvm服务的.
2、设置boot.lvm服务开机自启动,代码如下:
phpfensi.com:~ # chkconfig boot.lvm
boot.lvm off
phpfensi.com:~ # chkconfig boot.lvm on
3、启动boot.lvm服务,代码如下:
phpfensi.com:~ # /etc/init.d/boot.lvm start
Waiting for udev to settle...
Scanning for LVM volume groups...
Reading all physical volumes. This may take a while...
Found volume group "vgteas" using metadata type lvm2
Activating LVM volume groups...
PARTIAL MODE. Incomplete logical volumes will be processed.
1 logical volume(s) in volume group "vgteas" now active
done
启动后可以发现,这里自动发现了vgteas卷组.
4、同redhat略有不同的是,在suse下有一部分服务在rcx.d(x为0-6)运行级别下没有一些系统相关的服务,这部分服务在/etc/init.d目录下可以找到,不过其控制是否开机加载是在/etc/init.d/boot.d 目录下的,代码如下:
phpfensi.com:~ # ls /etc/rc.d/boot.d
K01boot.compliance K01boot.klog K01boot.udev_retry K04boot.localfs S02boot.rootfsck S13boot.fuse S14boot.ldconfig S17boot.kdump
K01boot.cycle K01boot.ldconfig K02boot.cleanup K06boot.rootfsck S03boot.clock S13boot.klog S14boot.quota
K01boot.debugfs K01boot.lvm_monitor K02boot.clock K08boot.device-mapper S04boot.device-mapper S13boot.lvm_monitor S14boot.sysctl
K01boot.efivars K01boot.proc K02boot.loadmodules K09boot.udev S04boot.loadmodules S13boot.proc S15boot.cleanup
K01boot.fuse K01boot.quota K02boot.localnet S01boot.debugfs S10boot.localfs S13boot.scpm S15boot.ipconfig
K01boot.ipconfig K01boot.scpm K02boot.swap S01boot.efivars S12boot.compliance S13boot.swap S16boot.apparmor
K01boot.kdump K01boot.sysctl K03boot.apparmor S01boot.udev S13boot.cycle S13boot.udev_retry S16boot.localnet
(2),修改lvm 的默认配置文件,以下是lvm配置文件的默认配置,代码如下:
phpfensi.com:~ # cat /etc/sysconfig/lvm
## Path: System/File systems/LVM
## Description: LVM configuration
## Type: string
## Default: ""
#
# This variable allows to only activate the LVM volume groups listed at
# bootup. If it is empty, all LVM volume groups are activated at bootup.
# This variable needs setting only under very special circumstances.
# For almost all standard LVM installations it can safely stay empty.
#
LVM_VGS_ACTIVATED_ON_BOOT=""
## Path: System/File systems/LVM
## Description: LVM configuration
## Type: string
## Default: "disable"
#
# This variable allows newly discovered VG to be activated automatically
# via udev rules. Set to "enable" to turn this feature on.
#
LVM_ACTIVATED_ON_DISCOVERED="disable"
从上面的注释说明来看,第二个参数设置成enable可以自动发现一些新创建的lvm分区并设置为active状态,这里将上面的disable改为enable,代码如下:
phpfensi.com:~ # sed -i 's/LVM_ACTIVATED_ON_DISCOVERED="disable"/LVM_ACTIVATED_ON_DISCOVERED="enable"/g' /etc/sysconfig/lvm
三、其他可能的原因及参考
在网上也查到一些其他原因可能会引起以上的情况出现.
情况1:uuid重复.
Problem(Abstract)
If a disk with Logical Volume Manager (LVM) on it is mounted to the original machine with the same disk, one or more duplicate Universal Unique Identifiers (UUID) are created
具体可以参看ibm站点上的技术文章,该问题貌似是redhat5等一些版本上存在的一个bug.
情况2:安装时未使用默认安装,导致未开机加载.
The system is not installed through the defualt installer, instead bootstrapped
through zypper and then installed additional patterns through YaST and might be
the cause the LVM not loading;
具体参看opensuse上的文档,这里的情况2,个人理解应该就是由于boot.lvm服务未开机自启动的原因,由于水平有限,并未能理解opensuse这个参考页上最后部分想表示的意思.
大型站长资讯类网站! https://www.nzzz.com.cn