Saturday, 27 December 2014

7-Mode Head Swap Script

Been meaning to post this for months and months just never got around to it!

This is just a simple but detailed script I concocted for performing 7-Mode Head Swaps - it’s stripped down to bare bones note form, and designed for Notepad/Notepad++/Simple Text Editors. As always with anything on this blog, it’s absolutely not official documentation so caveat lector!

##### COMPANYX
##### FASXXXXA to FASYYYYA
##### For CTRA / CTRB
##### 7-MODE Head Swap Script

# Variables:
# COMPANYX = Company Name
# CTRA / CTRB = Controller A/B
# FASXXXX = Old FAS System
# SYSID_OLDA / SYSID_OLDB = Old FAS Sysid's
# FASYYYY = New FAS System
# SYSID_NEWA / SYSID_NEWB = New FAS Sysid's

#####################################
##### PREPARATION AND PRECHECKS #####
#####################################

# NOTE 1: This script assumes both old and new controllers are on the same version of Data ONTAP
# NOTE 2: Pre-planning for how old ports map to new ports should have been completed!
# NOTE 3: Any new licensing requirements have already been prepared!

###############################
# FASXXXX - CTRA - SYSID_OLDA #
###############################

rdfile /etc/rc
ifconfig -a
rdfile /etc/hosts
rdfile /etc/exports
exportfs
storage show disk -p
aggr status
vol status

disk show -n # OBTAIN/CONFIRM SYSID
disk show -v
disk show -a # SHOULD SEE BOTH CONTROLLERS
sysconfig -a
fcadmin config

rlm status # WORKS FOR OLDER RLMs
sp status  # WORKS FOR NEWER SPs

vfiler status -a

# SAN Checks #

lun show
lun show -v
lun show -m
igroup show

# In the event lun serials change then the following command will be required to reset the lun serials:
# lun serial [-x]lun_path new_lun_serial)

options autosupport

vol status     # LOOK FOR root - vol0?
aggr status    # LOOK FOR root - aggr0?
df -A -g aggr0 # CHECK FREE SPACE
vol size vol0
vol size vol0 250g # TYPICAL VOL0 SIZE in 8.2.1

priv set advanced
ls /etc/software # VERIFY THE CORRECT IMAGE IS THERE (e.g. .tgz for upgrade from 8.X, or .zip from 7.X)

###############################
# FASXXXX - CTRB - SYSID_OLDB #
###############################

rdfile /etc/rc
ifconfig -a
rdfile /etc/hosts
rdfile /etc/exports
exportfs
storage show disk -p
aggr status
vol status

disk show -n # OBTAIN/CONFIRM SYSID
disk show -v
disk show -a # SHOULD SEE BOTH CONTROLLERS
sysconfig -a
fcadmin config

rlm status # WORKS FOR OLDER RLMs
sp status  # WORKS FOR NEWER SPs

vfiler status -a

# SAN Checks #

lun show
lun show -v
lun show -m
igroup show

# In the event lun serials change then the following command will be required to reset the lun serials:
# lun serial [-x]lun_path new_lun_serial)

options autosupport

vol status     # LOOK FOR root - vol0?
aggr status    # LOOK FOR root - aggr0?
df -A -g aggr0 # CHECK FREE SPACE
vol size vol0
vol size vol0 250g # TYPICAL VOL0 SIZE in 8.2.1

priv set advanced
ls /etc/software # VERIFY THE CORRECT IMAGE IS THERE (e.g. .tgz for upgrade from 8.X, or .zip from 7.X)

####################################################
##### IDENTIFY AND RECORD ALL EXISTING CABLING #####
####################################################

## RUN CONFIG ADVISOR ##

##############################
##### UPGRADE: Head Swap #####
##############################

###############################
# FASXXXX - CTRA - SYSID_OLDA #
###############################

aggr scrub status
aggr scrub stop # IF SCRUBS IN PROGRESS
ndmpd status
ndmpd off # IF ON
snapmirror status
snapmirror off # IF ON

cifs terminate
fcp stop
iscsi stop
nfs off

snap create vol0 pre_headswap
config dump pre_headswap
options autosupport.doit "pre_headswap"

###############################
# FASXXXX - CTRB - SYSID_OLDB #
###############################

aggr scrub status
aggr scrub stop # IF SCRUBS IN PROGRESS
ndmpd status
ndmpd off # IF ON
snapmirror status
snapmirror off # IF ON

cifs terminate
fcp stop
iscsi stop
nfs off

snap create vol0 pre_headswap
config dump pre_headswap
options autosupport.doit "pre_headswap"

###############################
# FASXXXX - CTRA - SYSID_OLDA #
###############################

cf disable
cf status
halt

###############################
# FASXXXX - CTRB - SYSID_OLDB #
###############################

cf status
halt

####################################
##### PHYSICAL REMOVAL/INSTALL #####
####################################

# Power off both old FASXXXX controllers and remove chassis from racks
# Physically install new FASYYYY controllers
# Reconnect all disk/back-end cabling as PER REQUIREMENTS
# NOTE: Front End cabling is reconnected later!

####################
##### POWER UP #####
####################

# Power on both FASYYYY controllers
# (can do one after the other, the main thing is that we boot both into maintenance mode)
# IMPORTANT: PRESS CTRL-C AND 5 FOR MAINTENCE MODE BOOT ON BOTH!

####################################################
# FASYYYY - CTRA - SYSID_NEWA # !MAINTENANCE MODE! #
####################################################

disk show -n # NEW SYSID =  SYSID_NEWA
disk show -v
## disk reassign -s -d
disk reassign -s SYSID_OLDA -d SYSID_NEWA
mailbox destroy local
mailbox destroy partner
aggr status
fcadmin config # Check FC ports initiators/targets as required
## fcadmin config -d Xx
## fcadmin config -t initiator Xx
## NOTE: ucadmin command for UTAs
halt

####################################################
# FASYYYY - CTRB - SYSID_NEWB # !MAINTENANCE MODE! #
####################################################

disk show -n # NEW SYSID =  SYSID_NEWB
disk show -v
## disk reassign -s -d
disk reassign -s SYSID_OLDB -d SYSID_NEWB
mailbox destroy local
mailbox destroy partner
aggr status
fcadmin config # Check FC ports initiators/targets as required
## fcadmin config -d Xx
## fcadmin config -t initiator Xx
## NOTE: ucadmin command for UTAs
halt

###############################
# FASYYYY - CTRA - SYSID_NEWA #
###############################

boot_ontap
aggr status
vol status

### NOTE: Check APPENDIX A if getting too much output to the console! ###

rdfile /etc/rc    # CHANGE AS PER REQUIREMENTS (e.g. wrfile /etc/rc)
rdfile /etc/hosts # CHANGE AS PER REQUIREMENTS (e.g. wrfile /etc/hosts)

### >> PASTE OUTPUT OF rdfile /etc/rc << ###

### >> PASTE OUTPUT OF rdfile /etc/hosts << ###

license

### >> PASTE OUTPUT OF license << ###

### May need to add updates licenses with >
## license add LICENSECODE # Can skip if licenses are okay
## license delete INVALID_LICENSES

### software update # IF REQUIRED>

sp setup

## IP Address = ???
## Netmask    = ???
## Gateway    = ???

halt

###############################
# FASYYYY - CTRB - SYSID_NEWB #
###############################

boot_ontap
aggr status
vol status

### NOTE: Check APPENDIX A if getting too much output to the console! ###

rdfile /etc/rc    # CHANGE AS PER REQUIREMENTS (e.g. wrfile /etc/rc)
rdfile /etc/hosts # CHANGE AS PER REQUIREMENTS (e.g. wrfile /etc/hosts)

### >> PASTE OUTPUT OF rdfile /etc/rc << ###

### >> PASTE OUTPUT OF rdfile /etc/hosts << ###

license

### >> PASTE OUTPUT OF license << ###

### May need to add updates licenses with >
## license add LICENSECODE # Can skip if licenses are okay
## license delete INVALID_LICENSES

### software update # IF REQUIRED>

sp setup

## IP Address = ???
## Netmask    = ???
## Gateway    = ???

halt

##########################################################
##### CONNECT FRONT END CONNECTIONS PER REQUIREMENTS #####
##########################################################

###############################
# FASYYYY - CTRA - SYSID_NEWA #
###############################

boot_ontap
version
ifconfig -a
cf status

###############################
# FASYYYY - CTRB - SYSID_NEWB #
###############################

boot_ontap
version
ifconfig -a
cf enable
cf status

###################
##### TESTING #####
###################

### HAS LUNS ###

lun show -v # ON A CHECK SERIALS
lun show -v # ON B CHECK SERIALS

### VFILERS IN USE ###

options licensed_feature.multistore.enable # ON A
vfiler status -a # ON A

options licensed_feature.multistore.enable # ON B
vfiler status -a # ON B

### NOTE: Check APPENDIX B if have issues with vfilers post head-swap and need to re-run vfiler setup ###

cf takeover # ON A
cf giveback # ON A

cf takeover # ON B
cf giveback # ON B

options autosupport # ON A check settings
options autosupport # ON B check settings
options autosupport.doit "post headswap" # ON A
options autosupport.doit "post headswap" # ON B

config diff pre_headswap # ON A
config diff pre_headswap # ON B

options autosupport.doit WEEKLY_LOG # ON A
options autosupport.doit WEEKLY_LOG # ON B

ndmp on # ON A (if was on before)
ndmp on # ON B (if was on before)

snapmirror on # ON A if was on before (NOTE: Check requirements for SnapMirror source and destination versions!)
snapmirror on # ON B if was on before (NOTE: Check requirements for SnapMirror source and destination versions!)

## RUN CONFIG ADVISOR ##

# And verify everything is okay!

#######################
##### THE END !!! #####
#######################

####################################################
##### APPENDIX A: (Optional) QUIETENING SYSLOG #####
####################################################

rdfile /etc/syslog.conf
wrfile /etc/syslog.conf

###########CONSOLE-NONE#################

#*.info   /dev/console
*.info    /etc/messages

###########PREFERRED####################

# Set the alert level for the console
*.err     /dev/console
# Set the alert level for the local messages file
*.info    /etc/messages
# Set the alert level for the @SYSLOG_SERVER_IP
*.info    @X.X.X.X

###########################################################
##### APPENDIX B: (If Issues) RE-RUNNING VFILER SETUP #####
###########################################################

# rdfile /vfiler_path/etc/exports
# rdfile /vfiler_path/etc/hosts
# rdfile /vfiler_path/etc/hosts.equiv
# rdfile /vfiler_path/etc/nsswitch.conf
# rdfile /vfiler_path/etc/resolv.conf
# vfiler create VFILER -r /vol/vol0/VFILER
# vfiler run VFILER setup

No comments:

Post a Comment