对于 Redhat 7.0 及更高版本,如果 LVM 构建到内核中,您应该不需要修改任何启动脚本来在启动时启用 LVM。 如果 LVM 构建为模块,则可能需要修改/etc/rc.d/rc.sysinit通过在读取以下内容的段落之前添加 "modprobe lvm-mod" 来加载 LVM 模块。
# LVM initialization, take 2 (it could be on top of RAID) if [ -e /proc/lvm -a -x /sbin/vgchange -a -f /etc/lvmtab ]; then action $"Setting up Logical Volume Management:" /sbin/vgscan && /sbin/vgchange -a y fi |
![]() | 此启动脚本片段来自 Red Hat 7.3 - 其他版本的 Redhat 可能看起来略有不同。 |
对于低于 7.0 的 Redhat 版本,需要编辑文件/etc/rc.d/rc.sysinit。查找显示 "Mount all other filesystems" 的行,并在其之前插入 vgscan 和 vgchange 命令。 您应确保在运行 LVM 命令之前,您的根文件系统以读/写方式挂载。
您可能还需要编辑文件/etc/rc.d/init.d/halt以在关闭时停用卷组。 将
vgchange -an |