#!/bin/ksh # IBM_PROLOG_BEGIN_TAG # This is an automatically generated prolog. # # bos72L src/bos/usr/lpp/bos/pre_migration.sh 1.38.1.23 # # Licensed Materials - Property of IBM # # COPYRIGHT International Business Machines Corp. 2003,2017 # All Rights Reserved # # US Government Users Restricted Rights - Use, duplication or # disclosure restricted by GSA ADP Schedule Contract with IBM Corp. # # IBM_PROLOG_END_TAG # @(#)32 1.38.1.23 src/bos/usr/lpp/bos/pre_migration.sh, migration, bos72L, l2017_44A4 10/30/17 16:31:04 ## pre_migration script # function needed to check blv size, called by boot_lv_check save_orig_blv_map () { for disk in $blv_disk_list; do #------------------------------------------------------------------ # There could be more than one range of used PPs on a given disk in # event that the BLV mirrored onto the same disk. #------------------------------------------------------------------ LANG=C lspv -p $disk | grep " $BLV " | \ awk -v disk=$disk '{print disk":"$1}' done > $ORIG_MAPFILE } # function needed to check blv size, called by boot_lv_check #------------------------------------------------------------------------- # Given logical partition information (lp_info) of the form : # check to see if we can extend the logical volume to the next adjacent # $pps_needed partitions. If we cannot then return 1. #------------------------------------------------------------------------- can_extend () { lp_info=$1 disk=`echo $lp_info | awk -F: '{print $1}'` lastpp=`echo $lp_info | awk -F- '{print $2}'` (( nextpp = lastpp + 1 )) grep "^$disk:" $FREE_MAPFILE | \ while read location; do if `echo $location | egrep -q ":$nextpp-"`; then lower_limit=`echo $location | awk -F: '{print $2}' | \ awk -F- '{print $1}'` upper_limit=`echo $location | awk -F: '{print $2}' | \ awk -F- '{print $2}'` (( free_pps = upper_limit - lower_limit + 1 )) if [[ $free_pps -ge $pps_needed ]]; then # Make sure we are still in the first 4GB of the disk (( physical_upper_loc = upper_limit * pp_size )) if [[ $physical_upper_loc -gt 4096 ]]; then break fi #---------------------------------------------- # Success! Enough adjacent partitions are free #---------------------------------------------- return 0 else break fi fi done return 1 } # function needed to check blv size, called by boot_lv_check create_free_space_map () { for disk in $blv_disk_list; do LANG=C lspv -p $disk | grep " free " | \ awk -v disk=$disk '{print disk":"$1}' done > $FREE_MAPFILE } #------------------------------------------------------------------------- # Given a disk name check to see if we find $pps_needed free contiguous # partitions for creating a new copy of the blv. If we can then append # the pp range map of the available space to the $NEW_MAPFILE, update the # free space map and return 0. If we cannot then return 1. NOTE: If this # function is called more than once for the same disk name then a separate # pp range will be allocated for each call. This will enable the code to # handle multiple copies of the blv on the same disk. #------------------------------------------------------------------------- can_create_contig () { disk=$1 grep "^$disk:" $FREE_MAPFILE | \ while read location; do lower_limit=`echo $location | awk -F: '{print $2}' | awk -F- '{print $1}'` upper_limit=`echo $location | awk -F: '{print $2}' | awk -F- '{print $2}'` (( free_pps = upper_limit - lower_limit + 1 )) if [[ $free_pps -ge $pps_needed ]]; then # Make sure we are still in the first 4GB of the disk (( upper_for_blv = lower_limit + pps_needed )) (( physical_upper_loc = upper_for_blv * pp_size )) if [[ $physical_upper_loc -gt 4096 ]]; then break fi return 0 fi done return 1 } # Determines if the blv is large enough, and if not, if it can be # expanded. function boot_lv_check { ODMDIR=/etc/objrepos #---------------------------------------------------- # Get the boot disk which will be the first LP on PV1 #---------------------------------------------------- boot_disk=`LANG=C lslv -m $BLV | grep "^0001 " | awk '{print $3}'` #-------------------------------------------- # Generate a list of all the disks in the blv #-------------------------------------------- blv_disk_list=`LANG=C lslv -l $BLV | tail +3 | awk '{print $1}' | sort -u` #------------------------------------------------- # Get the number of physical partitions in the blv #------------------------------------------------- num_pps=`LANG=C lslv -l $BLV | grep -w $boot_disk | awk '{print $2}' | \ awk -F: '{print $1}'` #-------------------------------- # Get the physical partition size #-------------------------------- pp_size=`LANG=C lsvg rootvg | grep " PP SIZE: " | awk '{print $6}'` #----------------------------- # Determine the blv size in MB #----------------------------- (( blv_size = pp_size * num_pps )) #----------------------------------------------------------------- # If the size of the blv is BLV_REQ_SPACE or greater then we don't # need to do anything. #----------------------------------------------------------------- if [[ $blv_size -lt $BLV_REQ_SPACE ]] then #---------------------------------------------------- # Get the number of copies of the boot logical volume #---------------------------------------------------- num_copies=`LANG=C lslv $BLV | grep "^COPIES:" | awk '{print $2}'` #------------------------------------ # Save the original pp map of the blv #------------------------------------ save_orig_blv_map #----------------------------------------------------------- # Create a pp map of the free space for each disk in the blv #----------------------------------------------------------- create_free_space_map # Need to see if enough room to expand and print message if not. #--------------------------------------------------------------------- # Determine the number of physical partitions needed to extend the blv #--------------------------------------------------------------------- (( pps_needed = ( BLV_REQ_SPACE - blv_size ) / pp_size )) (( pps_remain = ( BLV_REQ_SPACE - blv_size ) % pp_size )) if [[ $pps_remain -ne 0 ]] then (( pps_needed = pps_needed + 1 )) fi ABLE_TO_EXTEND=TRUE ABLE_TO_RELOCATE=TRUE #------------------------------------------------------------------- # For each copy of the blv check to see if we can extend that copy. # If any copy cannot be extended then we'll have to remove the blv # and recreate it. This is because you can't extend one copy and # relocate another - the same action has to be taken for all copies. #------------------------------------------------------------------- for copy in `cat $ORIG_MAPFILE`; do if ! can_extend $copy; then ABLE_TO_EXTEND= break fi done if [ ! "$ABLE_TO_EXTEND" ] then # Need to see if there are enough free partitions elsewhere #----------------------------------------------------------------- # Convert BLV_REQ_SPACE to the total number of physical partitions # needed to create a new, larger blv. #----------------------------------------------------------------- (( pps_needed = BLV_REQ_SPACE / pp_size )) (( pps_remain = BLV_REQ_SPACE % pp_size )) if [[ $pps_remain -ne 0 ]] then (( pps_needed = pps_needed + 1 )) fi #---------------------------------------------------------------------- # For each copy of the blv check to see if we can find space to create # that copy. If any copy cannot be relocated due to lack of space then # we'll have to recreate the original blv from the pp map we saved off # earlier. #---------------------------------------------------------------------- for copy in `cat $ORIG_MAPFILE | awk -F: '{print $1}'`; do if ! can_create_contig $copy; then ABLE_TO_RELOCATE= break fi done fi if [ ! "$ABLE_TO_RELOCATE" ] then echo " The Boot Logical Volume is less than 32MB, and there are not enough contiguous free partitions available to extend or move it. Please see if you can free any partitions in the first 4GB of the disk $BLV is currently on, or move the boot logical volume ($BLV) to another disk." fi fi } # Determines which software will be removed during the migration function removing_software { # Create a list of installed software LANG=C /usr/bin/lslpp -qlc -Ous > /tmp/old.installed.$$ # List of filesets potentially to be removed cat > /tmp/old.remove.$$ <> /tmp/old.remove.$$ <> /tmp/old.remove.$$ <> /tmp/old.remove.$$ <> /tmp/old.remove.$$ <> /tmp/old.remove.$$ < /tmp/html.oldwild.$$ < /tmp/old.html.$$ for each_file in $(cat /tmp/html.oldwild.$$) do grep -e $each_file /tmp/old.installed.$$ | cut -d':' -f2 >> /tmp/old.html.$$ done cat /tmp/old.html.$$ >> /tmp/old.remove.$$ rm /tmp/html.oldwild.$$ sort -u /tmp/old.remove.$$ > /tmp/old.remove.sorted.$$ [ $? -eq 0 ] && [ -f /tmp/old.remove.sorted.$$ ] && mv /tmp/old.remove.sorted.$$ /tmp/old.remove.$$ for each_file in $(cat /tmp/old.remove.$$) do cut -d':' -f2 /tmp/old.installed.$$ | grep -q $each_file if [[ $? = 0 ]] then if [[ $each_file = devices* ]] then echo $each_file >> $HOMEDIR/device_software_being_removed else echo $each_file >> $HOMEDIR/other_software_being_removed fi fi done # Save software installed for later use mv /tmp/old.installed.$$ $HOMEDIR/software_installed_before_migration } # lists the configuration files that will need to be user merged function user_merge { cat > /tmp/user_merge.$$ <> $HOMEDIR/configuration_files_not_merged fi done } # lists the configuration files that will be merged by the system function system_merge { cat > /tmp/system_merge.$$ < /tmp/system_merge_ODM.$$ < /tmp/system_merge_TCB.$$ <> $HOMEDIR/configuration_files_being_merged else echo $each_file >> $HOMEDIR/configuration_files_missing_from_system fi done for each_file in $(cat /tmp/system_merge_ODM.$$) do # if the file exists on the system, add it to the list if [[ -a $each_file ]] then echo $each_file >> $HOMEDIR/configuration_files_being_merged else echo $each_file >> $HOMEDIR/configuration_files_missing_from_system fi done for each_file in $(cat /tmp/system_merge_TCB.$$) do # if the file exists on the system, add it to the list if [[ -a $each_file ]] then echo $each_file >> $HOMEDIR/configuration_files_being_merged else echo $each_file >> $HOMEDIR/configuration_files_missing_from_system fi done } # saves all the files to me merged (ascii files only) function save_merged_files { cat > /tmp/save_merged.$$ <$HOMEDIR/software_consistency 2>&1 & echo $! >/tmp/lppchk.v.$$ } function fileset_checksum { lppchk -c >$HOMEDIR/software_checksum_verification 2>&1 & echo $! >/tmp/lppchk.c.$$ } function fileset_filecheck { lppchk -f >$HOMEDIR/software_file_existence_check 2>&1 & echo $! >/tmp/lppchk.f.$$ } function fileset_linkcheck { lppchk -l >$HOMEDIR/software_link_existence_check 2>&1 & echo $! >/tmp/lppchk.l.$$ } function tcbck_check { ODMDIR=/etc/objrepos odmget -q attribute=TCB_STATE PdAt | grep -q "tcb_enabled" if [[ $? = 0 ]] then echo " ATTENTION: Trusted Computing Base will not be enabled after the migration." fi } # Check_Down_Level - Determine if a fileset is installed at a level less # than the required level. # # Returns zero if fileset is installed below minimum level # Returns one otherwise function Check_Down_Level { fs=$1 minlevel=$2 installedlevel=`LANG=C /usr/bin/lslpp -qLc $fs 2>/dev/null | cut -d':' -f3` #If not installed, it's not down-level [[ -z "$installedlevel" ]] && return 0 # If it is installed, break apart the version, release, mod, and fix # portions of the minimal and installed levels # Cannot do mere alphabetical comparison because # there are no leading zeroes. 1.2.0.0 is # alphabetically later than 1.13.0.0, but it is # a numerically earlier level. OIFS=$IFS IFS=. set -- $installedlevel instV=$1;instR=$2;instM=$3;instF=$4 set -- $minlevel minV=$1;minR=$2;minM=$3;minF=$4 IFS=$OIFS if ( [[ $instV -lt $minV ]] || ( [[ $instV -eq $minV ]] && ( [[ $instR -lt $minR ]] || ( [[ $instR -eq $minR ]] && ( [[ $instM -lt $minM ]] || ( [[ $instM -eq $minM ]] && [[ $instF -lt $minF ]] )))))) then return 0 fi return 1 } function cleanup { rm /tmp/old.remove.$$ >/dev/null 2>&1 rm /tmp/old.html.$$ >/dev/null 2>&1 rm /tmp/user_merge.$$ >/dev/null 2>&1 rm /tmp/system_merge.$$ >/dev/null 2>&1 rm /tmp/system_merge_ODM.$$ >/dev/null 2>&1 rm /tmp/system_merge_TCB.$$ >/dev/null 2>&1 rm /tmp/save_merged.$$ >/dev/null 2>&1 } function more_major_no_checks { value2=$(ODMDIR=/etc/objrepos odmget -q "resource=ddins and value1=rootvg" CuDvDr | grep value2 | cut -d\" -f2) value3=$(ODMDIR=/etc/objrepos odmget -q "resource=ddins and value1=rootvg" CuDvDr | grep value3 | cut -d\" -f2) [ "$value2" != "10" ] && echo " The major number (value2) as in the CuDvDr ODM database for rootvg is not equal to 10. This may cause your migration to fail. Please contact your support representative." [ "$value3" != ";" ] && echo " The value3 field in the CuDvDr ODM database for rootvg is not equal to ';'. This may cause your migration to fail. Please contact your support representative." } function multibos_instance_check { ## 1TW checks that when blv=hd5, blvset with no P flag is correct ## checks that when blv=bos_hd5, the blvset with -P2 is correct, ## and if not, blvset with no P flag is correct. ## prints warnings if multible instances ## ## If BLV=hd5, we want to run bootinfo -g to determine ## if we are getting the right level PTEnumber=1 # standard PTE value diskname=`LANG=C /usr/sbin/lslv -m $BLV | /usr/bin/grep "^0001 " | /usr/bin/awk '{print $3}'` if [[ $BLV = hd5 ]] then # get the PTE number for hd5 PTEnumber=`/usr/sbin/bootinfo -g $BLV` if [[ $PTEnumber = 2 ]] then blv_level=`/usr/lpp/bosinst/blvset -d /dev/$diskname -g level` blv_level2=`/usr/lpp/bosinst/blvset -P2 -d /dev/$diskname -g level` if [[ $blv_level != $blv_level2 ]] then /usr/sbin/lsvg -l rootvg | /usr/bin/grep "^bos_hd5[ ]" | /usr/bin/grep boot >/dev/null if [[ $? = 0 ]] then ### Multibos instance echo " A bos_hd5 boot logical volume exists on your system, indicating that you have a standby BOS (multibos). Please remove the standby BOS before doing the operating system migration (multibos -XR). After removing the standby BOS, please run \"bosboot -ad /dev/ipldevice\", and the re-run this script. The level of the operating system on the disk does not match the level for the active BOS. Level of active BOS: $blv_level2 Level of operating system on disk: $blv_level " echo " A bos_hd5 boot logical volume exists on your system, indicating that you have a standby BOS (multibos). Please remove the standby BOS before doing the operating system migration (multibos -XR). After removing the standby BOS, please run \"bosboot -ad /dev/ipldevice\", and the re-run this script. The level of the operating system on the disk does not match the level for the active BOS. Level of active BOS: $blv_level2 Level of operating system on disk: $blv_level " >>$HOMEDIR/ATTENTION cleanup exit 1 else echo " During operating system migration, the level of AIX is gotten for every disk that has a rootvg, using the /usr/lpp/bosinst/blvset command. Your system is showing that the boot image has a PTE value of 2, as returned by /usr/sbin/bootinfo -g $BLV. Since there is no bos_hd5 currently on the system, the level returned by blvset without the -P2 flag, should match the level returned with the -P2 flag. During the install, the value, when blvset is run without the -P2 flag will be used. Level returned by blvset: $blv_level Level returned by blvset with -P2 flag: $blv_level2 It is recommended you run bosboot -ad /dev/ipldevice, and then rerun this script. " echo " During operating system migration, the level of AIX is gotten for every disk that has a rootvg, using the /usr/lpp/bosinst/blvset command. Your system is showing that the boot image has a PTE value of 2, as returned by /usr/sbin/bootinfo -g $BLV. Since there is no bos_hd5 currently on the system, the level returned by blvset without the -P2 flag, should match the level returned with the -P2 flag. During the install, the value, when blvset is run without the -P2 flag will be used. Level returned by blvset: $blv_level Level returned by blvset with -P2 flag: $blv_level2 It is recommended you run bosboot -ad /dev/ipldevice, and then rerun this script. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi ### End messages else # blvsets match, but still check for standby bos /usr/sbin/lsvg -l rootvg | /usr/bin/grep "^bos_hd5[ ]" | /usr/bin/grep boot >/dev/null if [[ $? = 0 ]] then ### Multibos instance echo " A bos_hd5 boot logical volume exists on your system, however it is not the boot logical volume you are booted from. This indicates there is a standby bos on your system, as created by the multibos command. It is recommended you remove the standby bos, multibos -XR, before migrating. " echo " A bos_hd5 boot logical volume exists on your system, however it is not the boot logical volume you are booted from. This indicates there is a standby bos on your system, as created by the multibos command. It is recommended you remove the standby bos, multibos -XR, before migrating. " >>$HOMEDIR/ATTENTION fi fi ### End blvset levels check else # go ahead and check for standby bos anyway /usr/sbin/lsvg -l rootvg | /usr/bin/grep "^bos_hd5[ ]" | /usr/bin/grep boot >/dev/null if [[ $? = 0 ]] then ### Multibos instance echo " A bos_hd5 boot logical volume exists on your system, however it is not the boot logical volume you are booted from. This indicates there is a standby bos on your system, as created by the multibos command. It is recommended you remove the standby bos, multibos -XR, before migrating. " echo " A bos_hd5 boot logical volume exists on your system, however it is not the boot logical volume you are booted from. This indicates there is a standby bos on your system, as created by the multibos command. It is recommended you remove the standby bos, multibos -XR, before migrating. " >>$HOMEDIR/ATTENTION fi fi ### End PTEnumber = 2 elif [[ $BLV = bos_hd5 ]] then # If BLV is bos_hd5, we will only use it if there isn't an hd5, # so check that first /usr/sbin/lsvg -l rootvg | /usr/bin/grep "^hd5[ ]" | /usr/bin/grep boot >/dev/null if [[ $? = 0 ]] then echo " The rootvg is booted from bos_hd5, yet there is also a hd5 boot logical volume on the system. This indicates hd5 is part of a standby bos instance, as created by multibos. If hd5 exists, the hd5, hd4, hd2, hd9var, and hd10opt logical volumes will be treated as the rootvg during migration. Please remove the standby bos so that the currently running system is the choice that will be migrated. (multibos -XR) Only one instance of the rootvg should exist. " echo " The rootvg is booted from bos_hd5, yet there is also a hd5 boot logical volume on the system. This indicates hd5 is part of a standby bos instance, as created by multibos. If hd5 exists, the hd5, hd4, hd2, hd9var, and hd10opt logical volumes will be treated as the rootvg during migration. Please remove the standby bos so that the currently running system is the choice that will be migrated. (multibos -XR) Only one instance of the rootvg should exist. " >>$HOMEDIR/ATTENTION else # we have only one instance # get the PTE number for bos_hd5, we expect it to be 2 PTEnumber=`/usr/sbin/bootinfo -g $BLV` if [[ $PTEnumber = 1 ]] then blv_level1=`/usr/lpp/bosinst/blvset -P1 -d /dev/$diskname -g level` # See if blvset -P2 fails /usr/lpp/bosinst/blvset -P2 -d /dev/$diskname -g level >/dev/null 2>&1 if [[ $? != 0 ]] then # this is good, check no P flag and P1 match blv_level=`/usr/lpp/bosinst/blvset -d /dev/$diskname -g level` if [[ $blv_level != $blv_level1 ]] then # matching would be good, but they don't match echo " The level on the disk, as gotten by the /usr/lpp/bosinst/blvset command, is not what is expected. Level running default blvset command: $blv_level Level running blvset command specifying the PTE return from bootinfo -g $BLV: $blv_level1 Please run \"bosboot -ad /dev/ipldevice\" and see if the condition is corrected. Then re-run this script. " echo " The level on the disk, as gotten by the /usr/lpp/bosinst/blvset command, is not what is expected. Level running default blvset command: $blv_level Level running blvset command specifying the PTE return from bootinfo -g $BLV: $blv_level1 Please run \"bosboot -ad /dev/ipldevice\" and see if the condition is corrected. Then re-run this script. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi else ### blvset -P2 successful, when no standby bos, and PTE=1 blv_level2=`/usr/lpp/bosinst/blvset -P2 -d /dev/$diskname -g level` echo " The bootlist -g $BLV command indicates the PTE number is 1, however the blvset command is successful specifying the -P2 flag. The level install code determines is on your disk, may not be correct. Level on the system is: $blv_level1 Level that will be indicated during install is: $blv_level2 " echo " The bootlist -g $BLV command indicates the PTE number is 1, however the blvset command is successful specifying the -P2 flag. The level install code determines is on your disk, may not be correct. Level on the system is: $blv_level1 Level that will be indicated during install is: $blv_level2 " >>$HOMEDIR/ATTENTION fi elif [[ $PTEnumber = 2 ]] then multibos_check_lvs blv_level2=`/usr/lpp/bosinst/blvset -P2 -d /dev/$diskname -g level` echo " The rootvg, which includes bos_hd5, bos_hd2, bos_hd4, bos_hd9var and bos_hd10opt logical volumes will be migrated from version $blv_level2 to 7.2. " echo " The rootvg, which includes bos_hd5, bos_hd2, bos_hd4, bos_hd9var and bos_hd10opt logical volumes will be migrated from version $blv_level2 to 7.2. " >>$HOMEDIR/ATTENTION fi ## End PTEnumber check for bos_hd5 fi ## End of else on having two blvs else echo " The rootvg is missing a boot logical volume named either hd5 or bos_hd5. The migration will not occur. " echo " The rootvg is missing a boot logical volume named either hd5 or bos_hd5. The migration will not occur. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi ### End hd5, bos_hd5, neither } function multibos_check_lvs { ## 1TW check that if blv is bos_hd5, that bos_hd4, bos_hd2 exists ## and bos_hd10opt exist. ## Get_RVG_Disks only checks for hd5, hd2, hd4, hd8 ## of bos_hd5, bos_hd2, bos_hd4, or hd8 if [[ $BLV = bos_hd5 ]] then # check for the other bos_ logical volumes /usr/sbin/lsvg -l rootvg | grep "^bos_hd4[ ]" >/dev/null if [[ $? = 0 ]] then /usr/sbin/lsvg -l rootvg | grep "^bos_hd2[ ]" >/dev/null if [[ $? != 0 ]] then echo " The boot logical volume is bos_hd5, but logical volume bos_hd2 does not exist. This rootvg will not be considered suitable for migration. " echo " The boot logical volume is bos_hd5, but logical volume bos_hd2 does not exist. This rootvg will not be considered suitable for migration. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi # end hd2 else echo " The boot logical volume is bos_hd5, but logical volume bos_hd4 does not exist. This rootvg will not be considered suitable for migration. " echo " The boot logical volume is bos_hd5, but logical volume bos_hd4 does not exist. This rootvg will not be considered suitable for migration. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi # end hd4 fi } function multibos_aix_level_check { ## 1TW Make sure we aren't getting a level of 0.0 for the system. PTEnumber=1 # standard PTE value # get the PTE number for hd5 PTEnumber=`/usr/sbin/bootinfo -g $BLV` diskname=`LANG=C /usr/sbin/lslv -m $BLV | /usr/bin/grep "^0001 " | /usr/bin/awk '{print $3}'` if [[ $PTEnumber = 2 ]] then blv_level=`/usr/lpp/bosinst/blvset -P2 -d /dev/$diskname -g level` elif [[ $PTEnumber = 1 ]] then blv_level=`/usr/lpp/bosinst/blvset -P1 -d /dev/$diskname -g level` else blv_level=`/usr/lpp/bosinst/blvset -d /dev/$diskname -g level` if [[ $? != 0 ]] then echo " The \"bootinfo -g $BLV\" command isn't returning 1 or 2, as expected. The system is not migratable. " echo " The \"bootinfo -g $BLV\" command isn't returning 1 or 2, as expected. The system is not migratable. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi fi if [[ $blv_level = 0.0 ]] then echo " The /usr/lpp/bosinst/blvset command returns a level of 0.0 for your disk. Please run \"bosboot -ad /dev/ipldevice\", and the re-run this script, to verify the condition is corrected. " echo " The /usr/lpp/bosinst/blvset command returns a level of 0.0 for your disk. Please run \"bosboot -ad /dev/ipldevice\", and the re-run this script, to verify the condition is corrected. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi if [[ $blv_level = 7.2 ]] then echo " The /usr/lpp/bosinst/blvset command returns a level of 7.2 for your disk. This rootvg can not be migrated. " echo " The /usr/lpp/bosinst/blvset command returns a level of 7.2 for your disk. This rootvg can not be migrated. " >>$HOMEDIR/ATTENTION cleanup exit 1 fi } # MAIN main Main export PATH="/usr/bin:/usr/sbin:/etc:/bin:$PATH" # Create directory for output TIMESTAMP=`/usr/bin/date +"%y %m %d %H %M %S" | sed 's/ //g'` mkdir /home/pre_migration.$TIMESTAMP if [[ $? = 0 ]] then HOMEDIR=/home/pre_migration.$TIMESTAMP else echo " pre_migration: failed making directory /home/pre_migration.$TIMESTAMP" exit 1 fi BLV=`bootinfo -v` BLV_REQ_SPACE=32 # The boot logical volume space (in MB) ORIG_MAPFILE=$TMPDIR/.map.orig.$$ # Original pp map of the boot logical volume FREE_MAPFILE=$TMPDIR/.map.free.$$ # Map of free space on all disks on which # blv resides SUPPORTED_SYSTEM=0 # Verify system supports 7.2 powertype=$( LC_ALL=C lsattr -El $(LC_ALL=C lsdev -cprocessor -Sa -Fname 2>/dev/null | sed -n '1p') -atype -Fvalue 2>/dev/null ) if [[ $powertype = PowerPC_POWER?([78]) ]] then SUPPORTED_SYSTEM=0 else echo " Only POWER 7 or greater systems, are supported to install version 7.2. If you are planning to use Mksysb Migration, please verify that the target system is POWER 7 or greater. " echo " Only POWER 7 or greater systems, are supported to install version 7.2. If you are planning to use Mksysb Migration, please verify that the target system is POWER 7 or greater. " >>$HOMEDIR/ATTENTION SUPPORTED_SYSTEM=1 SUPPORTED_SYSTEM=1 fi # Tell where saved information is echo " All saved information can be found in: $HOMEDIR " # Check that blvset is not returning a level of 0.0 multibos_aix_level_check # Check consistency with hd5 or bos_hd5 multibos_instance_check # Check if bos_hd5, that at least bos_hd4 and bos_hd2 exist also multibos_check_lvs # Check that major number is 10 for /dev/rootvg and /dev/$BLV number=$(ls -al /dev/rootvg | awk -F' ' '{print $5}') majornumber=${number%,} if [[ $majornumber -ne 10 ]] then echo " The major number of /dev/rootvg is not equal to 10. This may cause the migration to fail." echo " The major number of /dev/rootvg is not equal to 10. This may cause the migration to fail." >>$HOMEDIR/ATTENTION fi number=$(ls -al /dev/$BLV | awk -F' ' '{print $5}') majornumber=${number%,} if [[ $majornumber -ne 10 ]] then echo " The major number of /dev/$BLV is not equal to 10. This may cause the migration to fail." echo " The major number of /dev/$BLV is not equal to 10. This may cause the migration to fail." >>$HOMEDIR/ATTENTION fi more_major_no_checks if [[ $SUPPORTED_SYSTEM -eq 0 ]] then # check boot lv size echo " Checking size of boot logical volume ($BLV)." boot_lv_check fi # Check and inform user if kerberos is being used. KID=`ODMDIR=/etc/objrepos odmget -q "attribute=authm" CuAt | grep value|cut -f2 -d=|cut -f2 -d'"'| cut -f1 -d,` if [[ $KID = 131074 ]] || [[ $KID = 131073 ]] then echo " Kerberos is being used on your system. During the migration you will be asked to install Kerberos 5 software from the Expansion Pack CD." echo " Kerberos is being used on your system. During the migration you will be asked to install Kerberos 5 software from the Expansion Pack CD." >>$HOMEDIR/ATTENTION fi # Check disk size (minimum 20GB required) diskspace=`LANG=C lsvg rootvg | grep " TOTAL PPs: " | awk '{print $7}'` disksize=${diskspace##\(} if [[ $disksize -lt 20480 ]] then echo " The minimal disk requirement is 20GB. Be sure this much disk space is available." echo " The minimal disk requirement is 20GB. Be sure this much disk space is available." >>$HOMEDIR/ATTENTION fi # Check memory size (minimum 2GB required for migrations) mem=`bootinfo -r` if [[ $mem -lt 2097152 ]] then echo " 2GB or more of memory is recommended to run AIX Version 7.2." echo " 2GB or more of memory is recommended to run AIX Version 7.2." >>$HOMEDIR/ATTENTION fi # Check that xlC.rte is not less than 4.0.2.0 Check_Down_Level xlC.rte 4.0.2.0 if [[ $? = 0 ]] then echo " xlC.rte is less than 4.0.2.0. Please install APAR IY17981 before migrating." echo " xlC.rte is less than 4.0.2.0. Please install APAR IY17981 before migrating." >>$HOMEDIR/ATTENTION fi # Check that /usr/lib/security/fpm exists, and is in the inventory if [[ -d /usr/lib/security/fpm ]] then lslpp -w /usr/lib/security/fpm >/dev/null if [[ $? != 0 ]] then echo " ATTENTION: /usr/lib/security/fpm is a directory on your system, but not in the inventory database, which will cause problems migrating with NIM Alternate Disk Migration, NIMADM. Please ensure you are using bos.alt_disk_install.rte at level 6.1.2.0 or 5.3.9.0 for 6.1 systems or 5.3 systems respectively. Else, if you are migrating a 5.2 system have bos.rte.security at level 05.02.0000.0110. A 5300 TL6 system should have bos.rte.security at level 5.3.0.68 A 5300 TL7 system should have bos.rte.security at level 5.3.7.5 A 5300 TL8 system should have bos.rte.security at level 5.3.8.3 " echo " ATTENTION: /usr/lib/security/fpm is a directory on your system, but not in the inventory database, which will cause problems migrating with NIM Alternate Disk Migration, NIMADM. Please ensure you are using bos.alt_disk_install.rte at level 6.1.2.0 or 5.3.9.0 for 6.1 systems or 5.3 systems respectively. Else, if you are migrating a 5.2 system have bos.rte.security at level 05.02.0000.0110. A 5300 TL6 system should have bos.rte.security at level 5.3.0.68 A 5300 TL7 system should have bos.rte.security at level 5.3.7.5 A 5300 TL8 system should have bos.rte.security at level 5.3.8.3 " >>$HOMEDIR/ATTENTION fi fi # Check that xlC.aix50.rte is not greater than 13.1.2.0 Check_Down_Level xlC.aix50.rte 13.1.2.1 if [[ $? = 1 ]] then echo " ATTENTION: xlC.aix50.rte is at a level greater than 13.1.2.0, but after migration to 7200-00, xlC.aix61.rte, which replaces xlC.aix50.rte, will be at 13.1.2.0. You may wish to contact your service representative for a later level of xlC.aix61.rte." echo " ATTENTION: xlC.aix50.rte is at a level greater than 13.1.2.0, but after migration to 7200-00, xlC.aix61.rte, which replaces xlC.aix50.rte, will be at 13.1.2.0. You may wish to contact your service representative for a later level of xlC.aix61.rte." >>$HOMEDIR/ATTENTION fi # List software being removed from the system echo " Listing software that will be removed from the system." removing_software # List configuration files not merged echo " Listing configuration files that will not be merged." user_merge # List configuration files merged echo " Listing configuration files that will be merged." system_merge # Saving configuration files that will be merged echo " Saving configuration files that will be merged." save_merged_files tcbck_check # fileset consistency check echo " Running lppchk commands. This may take awhile." fileset_consistency fileset_checksum fileset_filecheck fileset_linkcheck # check if bos.net.ipsec.keymgt is installed, and if so, does the DB dir. exist grep -q ":bos.net.ipsec.keymgt:" $HOMEDIR/software_installed_before_migration if [[ $? = 0 ]] then if [[ ! -d /etc/ipsec/inet/DB ]] then echo " The directory /etc/ipsec/inet/DB is missing, which may cause problems during the migration of bos.net.ipsec.keymgt. Please reinstall bos.net.ipsec.keymgt, at the current level, using a force install, before migrating." echo " The directory /etc/ipsec/inet/DB is missing, which may cause problems during the migration of bos.net.ipsec.keymgt. Please reinstall bos.net.ipsec.keymgt, at the current level, using a force install, before migrating." >>$HOMEDIR/ATTENTION fi fi # If /tmp is encrypted, users can only migrate via NIM or NIMADM (no caching) tmp_is_efs=`LANG=C /usr/sbin/lsjfs2 /tmp | cut -f21 -d: | tail -1` if [[ "$tmp_is_efs" = "yes" ]]; then echo " The /tmp filesystem is encrypted. If you wish to migrate with /tmp encrypted, only NIMADM (no caching) and NIM migration are supported. The NIM SPOT must have clic.rte installed. Optionally you can remove and recreate /tmp without encryption." echo " The /tmp filesystem is encrypted. If you wish to migrate with /tmp encrypted, only NIMADM (no caching) and NIM migration are supported. The NIM SPOT must have clic.rte installed. Optionally you can remove and recreate /tmp without encryption." >>$HOMEDIR/ATTENTION fi # verify checks complete before cleanup while [[ -s /tmp/lppchk.l.$$ ]] do ps -p $(cat /tmp/lppchk.l.$$) | grep -q lppchk if [[ $? != 0 ]] then rm /tmp/lppchk.l.$$ fi done [ -s $HOMEDIR/software_link_existence_check ] && echo " Please check $HOMEDIR/software_link_existence_check for possible errors. " while [[ -s /tmp/lppchk.f.$$ ]] do ps -p $(cat /tmp/lppchk.f.$$) | grep -q lppchk if [[ $? != 0 ]] then rm /tmp/lppchk.f.$$ fi done [ -s $HOMEDIR/software_file_existence_check ] && echo " Please check $HOMEDIR/software_file_existence_check for possible errors. " while [[ -s /tmp/lppchk.c.$$ ]] do ps -p $(cat /tmp/lppchk.c.$$) | grep -q lppchk if [[ $? != 0 ]] then rm /tmp/lppchk.c.$$ fi done [ -s $HOMEDIR/software_checksum_verification ] && echo " Please check $HOMEDIR/software_checksum_verification for possible errors. " while [[ -s /tmp/lppchk.v.$$ ]] do ps -p $(cat /tmp/lppchk.v.$$) | grep -q lppchk if [[ $? != 0 ]] then rm /tmp/lppchk.v.$$ fi done [ -s $HOMEDIR/software_consistency ] && echo " Please check $HOMEDIR/software_consistency for possible errors. " # Tell where saved information is echo " All saved information can be found in: $HOMEDIR " # Recommend mksysb echo " It is recommended that you create a bootable system backup of your system before migrating. " cleanup exit 0