您好,登錄后才能下訂單哦!
本人習慣通過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進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。