最近去機房給一臺HP DL380G5重裝操作系統時,發現CentOS7無法識別到硬盤,這臺服務器做的raid1,有理由懷疑新系統無法支持老機器的raid卡,查了些資料在此做個記錄。
一、無法識別的原因
參看: https://www.kernel.org/doc/Documentation/scsi/hpsa.txt
Supported devices:
------------------
Smart Array P212
Smart Array P410
Smart Array P410i
Smart Array P411
Smart Array P812
Smart Array P712m
Smart Array P711m
StorageWorks P1210m
Additionally, older Smart Arrays may work with the hpsa driver if the kernel
boot parameter "hpsa_allow_any=1" is specified, however these are not tested
nor supported by HP with this driver. For older Smart Arrays, the cciss
driver should still be used.
The "hpsa_simple_mode=1" boot parameter may be used to prevent the driver from putting the controller into "performant" mode. The difference is that with simple mode, each command completion requires an interrupt, while with "performant mode"(the default, and ordinarily better performing) it is possible to have multiple command completions indicated by a single interrupt.
我們服務器的陣列卡型號爲E200,不受支持。文檔中也給出瞭解決辦法,即啓動參數加上”hpsa_allow_any=1″,最好再加上”hpsa_simple_mode=1″。
二、具體解決辦法
參看: https://tears.io/2016/01/03/installing-centos7-on-an-hp-g5-dl380/
1、安裝時
安裝界面選中“Install Centos 7”,按Tab鍵添加啓動參數,鍵入空格+“hpsa.hpsa_simple_mode=1 hpsa.hpsa_allow_any=1”,回車進入安裝過程。
2、第一次啓動
在grub界面按e進入編輯模式,在倒數第二行同樣添加參數” hpsa.hpsa_simple_mode=1 hpsa.hpsa_allow_any=1 “,按ctrl+x保存並引導系統,如圖:
grub界面
添加hpsa參數
3、永久生效
兩種方法,一種是編輯 /etc/default/grub,添加參數如下:
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv=centos/swap rhgb quiet hpsa.hpsa_simple_mode=1 hpsa.hpsa_allow_any=1"
GRUB_DISABLE_RECOVERY="true"
然後是運行” grub2-mkconfig -o /boot/grub2/grub.cfg “並重啓服務器。
一種是編輯 /boot/grub2/grub.cfg ,在第100行添加 “hpsa.hpsa_simple_mode=1 hpsa.hpsa_allow_any=1” ,等同於第一次啓動時編輯grub的操作:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'CentOS Linux (3.10.0-957.el7.x86_64) 7 (Core)' --class centos --class gnu-linux --class gnu --class os --unrestricte
d $menuentry_id_option 'gnulinux-3.10.0-957.el7.x86_64-advanced-72958a75-1ac7-4cc8-be70-40fb90998d17' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod xfs
set root='hd0,msdos1'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --
hint='hd0,msdos1' d3d4a871-2cf4-4488-bbb6-3988ab56af37
else
search --no-floppy --fs-uuid --set=root d3d4a871-2cf4-4488-bbb6-3988ab56af37
fi
linux16 /vmlinuz-3.10.0-957.el7.x86_64 root=/dev/mapper/centos-root ro crashkernel=auto rd.lvm.lv=centos/root rd.lvm.lv
=centos/swap rhgb quiet LANG=zh_CN.UTF-8 hpsa.hpsa_simple_mode=1 hpsa.hpsa_allow_any=1
initrd16 /initramfs-3.10.0-957.el7.x86_64.img
}
重啓服務器生效。