本人习惯通过cobbler部署物理机系统,那我就来说说部署系统前需要做哪些准备。
1.BIOS设置是否符合标准。比如F1/F2错误提示、系统启动顺序、是否有开启PXE启动等。
2.你从哪个网卡进行pxe引导,cobbler部署需确定对应服务器网卡的MAC地址。
3.做磁盘阵列,此项是最耗费时间的。也是这个原因,才有了这个文档。
4.更改idrac root用户的密码,并新增一个组内通用用户。
一、racadm环境部署及文档说明
此文档仅适用于dell且配置了iDRAC远程管理卡的机器(主要是配置了idrac ip,方便远程连接)。全文脚本依赖于racadm环境,需在放置脚本的服务器上安装srvadmin包。以下脚本就是为解决前文中的系统部署前准备事宜。
环境部署如下:
# wget http://downloads.dell.com/FOLDER03574555M/1/OM-MgmtStat-Dell-Web-LX-8.3.0-1908_A00.tar.gz -P /tmp/ # tar zxvf OM-MgmtStat-Dell-Web-LX-8.3.0-1908_A00.tar.gz # cd /tmp/linux/rac/RHEL6/x86_64/ # rpm -ivh srvadmin* # ln -s /opt/dell/srvadmin/bin/racadm /usr/bin/racadm
具体命令和用法,我就不说了,大家可以参考以下手册
http://www.dell.com/support/manuals/us/en/19/idrac7-8-with-lc-v2.20.20.20/iDRAC_RACADM_Pub-v3/storage?guid=GUID-9E3676CB-B71D-420B-8C48-C80ADD258E03&lang=en-us
二、 脚本说明
脚本部分一共包含三部分。
run.sh:运行脚本,此脚本从hosts.conf文件中获取信息并后台执行bin目录下的脚本,实现多机器并发。
hosts文件:脚本从文本文件中获取ip信息,网卡号,需配置的阵列类型等。
README文档
modules目录:此目录放置实现网卡获取、用户添加、raid配置等脚本,因篇幅较长,后续逐渐更新。
1.run.sh脚本内容
#!/bin/bash # chenss # date : 2016-09-10 PATH="/opt/dell/srvadmin/bin/:/opt/dell/srvadmin/sbin/:$PATH" if [ $# -gt 0 ]; then echo -e "\e[0;31;1mCorrect syntax: sh run.sh\e[0m" exit fi start=`date +%s` NicGetMac='/data/script/idrac/modules/modules_GetNicMac.sh' CreateRaid='/data/script/idrac/modules/modules/modules_CreateRaid.sh' AddUser='/data/script/idrac/modules/modules_AddUser.sh' Check='/data/script/idrac/modules/modules/modules_SetBios.sh' delvd='/data/script/idrac/modules/modules/modules_DelVds.sh' disk_convert='/data/script/idrac/modules/modules/modules_DiskModeConvert.sh' defpass='/data/script/idrac/modules/modules_RestorPass.sh' reboot='/data/script/idrac/modules/modules/modules_SysReboot.sh' pxe='/data/script/idrac/modules/bootseq.sh' idrac_file='/data/script/idrac/hosts' NewInit='/data/script/idrac/modules/modules_NewInit.sh' cat << EOF ########## please option your choice: [1-10] ############ (1) Get server NIC mac-address (2) Remove all or the virtual disk other than the system disk (3) Physical Disk mode convert (4) Create raid1 or raid5 (5) Add idrac user and change root passwd (6) Bios disable F1/F2 errot prompt and setup HDD first boot (7) check system boot seq (8) Restore the root default password (9) reboot system (10) New server raid、bios init (99) Execute the command manually (*) exit script ######################################################## EOF read -p "please option your choice: " choice case $choice in 1)script="$NicGetMac";; 2)read -p "This operation will remove virtual disk,Are you sure? [Y|N]" confirm if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then script="$delvd" read -p "Romve all or no system virtual disk? [all|nosys]" rmvd if [ "$rmvd" != "all" -a "$rmvd" != "nosys" ]; then echo -e "\e[0;31;1m: argu error,you can only enter 'all' or 'nosys',please enter again\e[0m" exit fi else echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m" exit fi;; 3)read -p "This operation will convert disk mode,May be erase disk data,Are you sure? [Y|N]" confirm if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then script="$disk_convert" else echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m" exit fi;; 4)read -p "This operation will create raid,May be erase disk data,Are you sure? [Y|N]" confirm if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then script="$CreateRaid" else echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m" exit fi;; 5)script="$AddUser";; 6)script="$Check";; 7)script="$pxe";; 8)script="$defpass";; 9)read -p "This operation will reboot system,Are you sure? [Y|N]" confirm if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then script="$reboot" fi;; 10)read -p "This operation will remove virtual disk,Are you sure? [Y|N]" confirm if [ "$confirm" == "Y" -o "$confirm" == "y" ]; then script="$all" else echo -e "\e[0;31;1mYou can only enter 'Y' or 'N',please enter again\e[0m" exit fi;; 99)read -p "please input command: " a b c d e f g;; *)echo -e "\e[0;31;1margu error,please check...\e[0m" exit;; esac if egrep -v '^#|^$|^NIC|^RAID' $idrac_file | grep '[^[:digit:]].*-' &> /dev/null; then menu_ipseq='1' else menu_ipseq='2' fi function ShExec { NUM=`grep '^NIC' $idrac_file | awk '{print $2}'` mode=`egrep '^mode' $idrac_file | awk '{print $2}'` raid_level=`egrep '^RAID' $idrac_file | awk '{print $2}'` if [ -n "$a" ]; then racadm -r $idrac_ip -u root -p calvin $a $b $c $d $e $f $g --nocertwarn | egrep -v -B 9 'Default username' elif [ "`basename $script`" == "modules_GetNicMac.sh" ]; then sh $script $idrac_ip $NUM elif [ "`basename $script`" == "modules_DelVds.sh" ]; then sh $script $idrac_ip $rmvd elif [ "`basename $script`" == "modules_DiskModeConvert.sh" ]; then sh $script $idrac_ip $mode elif [ "`basename $script`" == "all.sh" ]; then sh $script $idrac_ip $mode $raid_level else sh $script $idrac_ip $raid_level fi } function SEQ { egrep -v '^#|^$' $idrac_file | grep '[^[:digit:]].*-' | while read idracs; do prefix=`echo $idracs | awk -F '[.-]' '{print $1"."$2"."$3}'` begin=`echo $idracs | awk -F '[.-]' '{print $4}'` end=`echo $idracs | awk -F '[.-]' '{print $5}'` for i in `seq ${begin} ${end}`; do { idrac_ip=${prefix}.$i ShExec }& done wait done } function NOSEQ { egrep -v '^#|^;|^$' $idrac_file | grep '^[[:digit:]].*$' | while read idracs; do { idrac_ip=`echo $idracs | awk '{print $1}'` ShExec }& wait done } case $menu_ipseq in 1) SEQ;; 2) NOSEQ;; *) echo "usage: error,please check script!" esac over=`date +%s` echo "used time : `expr $over - ${start}`s"
2.hosts文件内容,初步定义如下。
# 网卡编号 NIC_NUM: 1 # 需转换的硬盘模式 mode: all_raid # RAID 级别 RAID: 5 # IDRAC IP 列表 192.168.1.1-10
3.README文档介绍
一、脚本运行格式: sh run.sh 然后根据需求选择需执行的操作 ########## please option your choice: [1-10] ############ (1) Get server NIC mac-address (2) Remove all or the virtual disk other than the system disk (3) Physical Disk mode convert (4) Create raid1 or raid5 (5) Add idrac user (JPush) and change root passwd (6) Bios disable F1/F2 errot prompt and setup HDD first boot (7) check system boot seq (8) Restore the root default password (9) reboot system (10) New server raid、bios init (99) Execute the command manually ######################################################## 二、执行脚本选项说明 1.获取服务器网卡的 mac-address 2.根据需求删除所有虚拟磁盘或保留除系统盘的其它所有虚拟磁盘(机器转hadoop业务或出厂阵列不规划时应用) 3.硬盘(包含SSD)在直通和raid模式间转换。 4.创建raid1或raid5。 5.添加idrac用户、更改及恢复默认root用户密码。 6.更改BIOS(禁用F1、硬盘第一引导) 7.检查系统第一启动项 8.还原IDRAC root用户密码为 calvin 9.通过IDRAC强行重启服务器 10.把阵列清除、阵列创建、BIOS更改封装在一个脚本(阵列创建格式同选项4) 99.执行传递的idrac命令 三、hosts文件填写规范 1.NIC_NUM后的数字表示第几块网卡,电口用网口3或4进行PXE安装,光口用网口1或2进行PXE安装 2.硬盘模式: [ all_raid | hdd_raid | hdd_jobd | ssd_raid | ssd_jobd ] (脚本会执行机器重启操作) 书写格式:mode和”硬盘模式“间必须有空格。例:[ mode: hdd_raid ] 或 [ mode hdd_raid ] 均可。 all_raid:所有硬盘都转换为RAID模式 hdd_raid:除2块558G系统盘外,所有HDD磁盘转换为RAID模式 hdd_jobd:除2块558G系统盘外,所有磁盘转换为直通模式 ssd_raid:所有SSD磁盘转换为RAID模式 ssd_jobd:所有SSD磁盘转换为直通模式 3.阵列类型: [ 1 | 5 ] RAID5说明: 方式一:有2块558G左右盘做sda ,其余HDD做sdb 方式二:所有HDD大小一样,划分300G做sda,剩下做sdb。两种方式都会判断是否有SSD) 硬盘模式说明(脚本会执行机器重启操作): 4.IDRAC IP书写格式: 方式一:192.168.1.1-10 方式二: 192.168.1.1 192.168.1.2 192.168.1.3
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。