RAID | 更新驱动
RAID | 更新驱动
背景
联想SR650服务器采用的RAID卡 Ubuntu16不支持且PXE装机环境也不支持,导致PXE无法自动装机,即使ISO挂载方式装Ubuntu16,也导致Ubuntu16无法开机挂载磁盘。
需要做如下2步:
- 先搞定PXE装机环境驱动,这样可以进行装机操作;(自己编译)
- 搞定Ubuntu16驱动,这样装机后可以正常挂载磁盘;(自己编译或找厂商要)
因此需要在PXE系统版本的环境下编译一个RAID驱动然后打上。
涉及机器2台:
- 机器A:PXE装机环境,基于busybox,运行在内存中,模块基于centos7.5编译的;
- 机器B:临时机器,用于搭建编译环境,然后将编译好的模块拷贝到A上装机。
操作步骤
查看RAID卡信息
lspci -nn | grep "SAS"
然后从官网或厂商查找相关驱动包
查看当前RAID驱动版本
# modinfo megaraid_sas
filename: /lib/modules/3.10.0-862.el7.x86_64/kernel/drivers/scsi/megaraid/megaraid_sas.ko.xz
description: Avago MegaRAID SAS Driver
author: megaraidlinux.pdl@avagotech.com
version: 07.702.06.00-rh2 #当前版本
license: GPL
retpoline: Y
rhelversion: 7.5 #编译的系统centos7.5
srcversion: A19DC3530FA946F3FE5CCAD
alias: pci:v00001000d0000001Csv*sd*bc*sc*i*
alias: pci:v00001000d0000001Bsv*sd*bc*sc*i*
alias: pci:v00001000d00000017sv*sd*bc*sc*i*
alias: pci:v00001000d00000016sv*sd*bc*sc*i*
alias: pci:v00001000d00000014sv*sd*bc*sc*i*
alias: pci:v00001000d00000053sv*sd*bc*sc*i*
alias: pci:v00001000d00000052sv*sd*bc*sc*i*
alias: pci:v00001000d000000CFsv*sd*bc*sc*i*
alias: pci:v00001000d000000CEsv*sd*bc*sc*i*
alias: pci:v00001000d0000005Fsv*sd*bc*sc*i*
alias: pci:v00001000d0000005Dsv*sd*bc*sc*i*
alias: pci:v00001000d0000002Fsv*sd*bc*sc*i*
alias: pci:v00001000d0000005Bsv*sd*bc*sc*i*
alias: pci:v00001028d00000015sv*sd*bc*sc*i*
alias: pci:v00001000d00000413sv*sd*bc*sc*i*
alias: pci:v00001000d00000071sv*sd*bc*sc*i*
alias: pci:v00001000d00000073sv*sd*bc*sc*i*
alias: pci:v00001000d00000079sv*sd*bc*sc*i*
alias: pci:v00001000d00000078sv*sd*bc*sc*i*
alias: pci:v00001000d0000007Csv*sd*bc*sc*i*
alias: pci:v00001000d00000060sv*sd*bc*sc*i*
alias: pci:v00001000d00000411sv*sd*bc*sc*i*
depends:
intree: Y
vermagic: 3.10.0-862.el7.x86_64 SMP mod_unload #内核版本 modversions
signer: CentOS Linux kernel signing key
sig_key: 3A:F3:CE:8A:74:69:6E:F1:BD:0F:37:E5:52:62:7B:71:09:E3:2B:96
sig_hashalgo: sha256
parm: lb_pending_cmds:Change raid-1 load balancing outstanding threshold. Valid Values are 1-128. Default: 4 (int)
parm: max_sectors:Maximum number of sectors per IO command (int)
parm: msix_disable:Disable MSI-X interrupt handling. Default: 0 (int)
parm: msix_vectors:MSI-X max vector count. Default: Set by FW (int)
parm: allow_vf_ioctls:Allow ioctls in SR-IOV VF mode. Default: 0 (int)
parm: throttlequeuedepth:Adapter queue depth when throttled due to I/O timeout. Default: 16 (int)
parm: resetwaittime:Wait time in seconds after I/O timeout before resetting adapter. Default: 180 (int)
parm: smp_affinity_enable:SMP affinity feature enable/disbale Default: enable(1) (int)
parm: rdpq_enable: Allocate reply queue in chunks for large queue depth enable/disable Default: disable(0) (int)
parm: dual_qdepth_disable:Disable dual queue depth feature. Default: 0 (int)
parm: scmd_timeout:scsi command timeout (10-90s), default 90s. See megasas_reset_timer. (int)
搭建对应的编译环境
-
查看当前内核版本
uname -r
3.10.0-514.el7.x86_64 -
下载内核:
- kernel-3.10.0-862.el7.centos.x86_64.rpm
- kernel-devel-3.10.0-862.el7.x86_64.rpm
-
更新内核
yum install kernel-3.10.0-862.el7.centos.x86_64.rpm
-
安装完毕后检查
rpm -qa | grep kernel
kernel-tools-3.10.0-514.el7.x86_64
kernel-devel-3.10.0-514.el7.x86_64
kernel-tools-libs-3.10.0-514.el7.x86_64
kernel-headers-3.10.0-514.el7.x86_64
kernel-3.10.0-862.el7.centos.x86_64
-
查看grub启动项
awk -F\\' \'$1=="menuentry " {print $2}\' /etc/grub2.cfg
CentOS Linux (3.10.0-862.el7.centos.x86_64) 7 (Core)
CentOS Linux (3.10.0-514.el7.x86_64) 7 (Core)
CentOS Linux (0-rescue-caa20f35d41640498c092c1c844ef4c9) 7 (Core)
862的版本位于位置0,因此修改vim /etc/default/grub
然后找到GRUB_DEFAULT=saved
,将saved修改为内核位置,此处为0,则改为GRUB_DEFAULT=0
-
重建grub
grub2-mkconfig -o /boot/grub2/grub.cfg
# grub2-mkconfig -o /boot/grub2/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.10.0-862.el7.centos.x86_64
Found initrd image: /boot/initramfs-3.10.0-862.el7.centos.x86_64.img
Found linux image: /boot/vmlinuz-3.10.0-514.el7.x86_64
Found initrd image: /boot/initramfs-3.10.0-514.el7.x86_64.img
Found linux image: /boot/vmlinuz-0-rescue-caa20f35d41640498c092c1c844ef4c9
Found initrd image: /boot/initramfs-0-rescue-caa20f35d41640498c092c1c844ef4c9.img
-
重启验证
uname -r
编译驱动
-
解压驱动包
tar -zxvf megaraid_sas-07.712.02.00-src.tar.gz
-
进入目录后执行
./compile.sh
- 查看编译好的megaraid_sas.ko文件
#modinfo ~/megaraid_sas.ko
filename: /root/megaraid_sas.ko
description: Broadcom MegaRAID SAS Driver
author: megaraidlinux.pdl@broadcom.com
version: 07.712.02.00
license: GPL
rhelversion: 7.5
srcversion: C8328C2E3BFC8F1D2E39CC6
alias: pci:v00001000d000010E7sv*sd*bc*sc*i*
alias: pci:v00001000d000010E4sv*sd*bc*sc*i*
alias: pci:v00001000d000010E3sv*sd*bc*sc*i*
alias: pci:v00001000d000010E0sv*sd*bc*sc*i*
alias: pci:v00001000d000010E6sv*sd*bc*sc*i*
alias: pci:v00001000d000010E5sv*sd*bc*sc*i*
alias: pci:v00001000d000010E2sv*sd*bc*sc*i*
alias: pci:v00001000d000010E1sv*sd*bc*sc*i*
alias: pci:v00001000d0000001Csv*sd*bc*sc*i*
alias: pci:v00001000d0000001Bsv*sd*bc*sc*i*
alias: pci:v00001000d00000017sv*sd*bc*sc*i*
alias: pci:v00001000d00000016sv*sd*bc*sc*i*
alias: pci:v00001000d00000015sv*sd*bc*sc*i*
alias: pci:v00001000d00000014sv*sd*bc*sc*i*
alias: pci:v00001000d00000053sv*sd*bc*sc*i*
alias: pci:v00001000d00000052sv*sd*bc*sc*i*
alias: pci:v00001000d000000CFsv*sd*bc*sc*i*
alias: pci:v00001000d000000CEsv*sd*bc*sc*i*
alias: pci:v00001000d0000005Fsv*sd*bc*sc*i*
alias: pci:v00001000d0000005Dsv*sd*bc*sc*i*
alias: pci:v00001000d0000002Fsv*sd*bc*sc*i*
alias: pci:v00001000d0000005Bsv*sd*bc*sc*i*
alias: pci:v00001028d00000015sv*sd*bc*sc*i*
alias: pci:v00001000d00000413sv*sd*bc*sc*i*
alias: pci:v00001000d00000071sv*sd*bc*sc*i*
alias: pci:v00001000d00000073sv*sd*bc*sc*i*
alias: pci:v00001000d00000079sv*sd*bc*sc*i*
alias: pci:v00001000d00000078sv*sd*bc*sc*i*
alias: pci:v00001000d0000007Csv*sd*bc*sc*i*
alias: pci:v00001000d00000060sv*sd*bc*sc*i*
alias: pci:v00001000d00000411sv*sd*bc*sc*i*
depends:
vermagic: 3.10.0-862.el7.x86_64 SMP mod_unload modversions
parm: lb_pending_cmds:Change raid-1 load balancing outstanding threshold. Valid Values are 1-128. Default: 4 (int)
parm: max_sectors:Maximum number of sectors per IO command (int)
parm: msix_disable:Disable MSI-X interrupt handling. Default: 0 (int)
parm: msix_vectors:MSI-X max vector count. Default: Set by FW (int)
parm: allow_vf_ioctls:Allow ioctls in SR-IOV VF mode. Default: 0 (int)
parm: throttlequeuedepth:Adapter queue depth when throttled due to I/O timeout. Default: 16 (int)
parm: resetwaittime:Wait time in (1-180s) after I/O timeout before resetting adapter. Default: 180s (int)
parm: smp_affinity_enable:SMP affinity feature enable/disable Default: enable(1) (int)
parm: rdpq_enable:Allocate reply queue in chunks for large queue depth enable/disable Default: enable(1) (int)
parm: dual_qdepth_disable:Disable dual queue depth feature. Default: 0 (int)
parm: scmd_timeout:scsi command timeout (10-90s), default 90s. See megasas_reset_timer. (int)
parm: crashdump_enable:Firmware Crash dump feature enable/disbale Default: enable(1) (int)
parm: perf_mode:Performance mode (only for Aero adapters), options:
0 - balanced: High iops and low latency queues are allocated &
interrupt coalescing is enabled only on high iops queues
1 - iops: High iops queues are not allocated &
interrupt coalescing is enabled on all queues
2 - latency: High iops queues are not allocated &
interrupt coalescing is disabled on all queues
default mode is \'balanced\' (int)
parm: event_log_level:Asynchronous event logging level- range is: -2(CLASS_DEBUG) to 4(CLASS_DEAD), Default: 2(CLASS_CRITICAL) (int)
parm: disable_ext_io:Disable 1M IO support Default: 0(1M IO enabled) (int)
parm: enable_sdev_max_qd:Enable sdev max qd as can_queue. Default: 0 (int)
此时可将该文件拷贝到A机器系统中进行验证,可用insmod megaraid_sas.ko
来查看
至此PXE自动装机环境驱动搞定;
更新OS镜像
将老的Ubuntu16装机镜像安装到机器B上,然后将RAID驱动(非上面编译的那个用于centos的驱动)打上
-
拷贝到系统驱动目录
cp megaraid_sas.ko /lib/modules/3.10.0-862.el7.x86_64/kernel/drivers/scsi/megaraid
-
更新内核模块依赖关系
depmod -a
-
然后PXE启动进入无盘环境,将机器B上的系统删减后重新打包tarball。
-
在机器A上进行安装Ubuntu16进行测试。