LENOVO服务器批量升级BMC固件
需求:通过服务器远程管理IP批量升级IMM、UEFI固件
工具:asu64、ipmitool、iflash64、cdc_interface.sh
下载:http://pan.baidu.com/s/1pL1uOaB
第一步,将要更新BMC IP写入 ip.conf
10.17.2.34 10.17.6.54 10.17.22.80 10.17.5.74 10.17.5.3
第二步,验证当前BMC帐号 userlist.sh
#!/bin/bash true > userlist.txt while read line; do ip=`echo $line|awk \'{print $1}\'` ipmitool -H $ip -I lanplus -U userid -P password user list >/dev/null ret=$? if [ $ret -eq 0 ] then printf "$ip OK\n">>userlist.txt else printf "$ip ERR\n">>userlist.txt fi done < ./ip.conf
第三步,编辑批量ping脚本 server_ping.sh
#!/bin/bash true > out.txt while read line; do ip=`echo $line|awk \'{print $1}\'` ping -w 1 -c 1 $ip>/dev/null ret=$? if [ $ret -eq 0 ] then printf "$ip OK\n">>out.txt else printf "$ip ERR\n">>out.txt fi done < ./ip.conf
第四步,编辑批量关机脚步 power_off.sh
#!/bin/bash user=userid password=password while read ip; do ipmitool -H $ip -I lanplus -U $user -P $password power off done < ./ip.conf
第五步,编写批量升级uefi脚本 iflash.sh
#!/bin/bash user=userid password=password while read ip; do ./iflash64 --package ibm_fw_uefi_d7e154b-2.21_anyos_32-64.uxz --host $ip --user $user --password $password --force done < ./ip.conf
第六步,执行批量ping 查看结果全部ok
[root@asu64]# sh server_ping.sh [root@asu64]# cat out.txt 10.17.2.34 OK 10.17.6.54 OK 10.17.22.80 OK 10.17.5.74 OK 10.17.5.33 OK
第七步,执行power_off.sh 批量关机
[root@asu64]# sh power_off.sh Chassis Power Control: Down/Off Chassis Power Control: Down/Off Chassis Power Control: Down/Off Chassis Power Control: Down/Off Chassis Power Control: Down/Off
第八步,执行批量升级脚本
[root@asu64]# sh iflash.sh
第九步,升级完成提示需要重启服务器
IBM Command Line IMM Flash Update Utility v1.12.24 Licensed Materials - Property of IBM (C) Copyright IBM Corp. 2009 - 2013 All Rights Reserved. Pinging IMM IP address 10.17.5.33 .....OK Connected to IMM at IP address 10.17.5.33. Update package firmware type: uEFI Update package build level: D7E154B Target\'s current build level: D7E136A The IMM is preparing to receive the update. Transferring image: 98% Transfer complete. Validating image. Updating firmware: 100% Update complete. Firmware flashed successfully Following the UEFI flash update, allow the system to reboot to the F1 prompt to complete the update process. Fail to take down the LAN-over-USB interface.
第十步,批量重启服务器,升级完成。
[root@asu64]# sh power_on.sh Chassis Power Control: Down/On Chassis Power Control: Down/On Chassis Power Control: Down/On Chassis Power Control: Down/On Chassis Power Control: Down/On
登陆BMC界面验证升级是否成功