linux nodes – tsm backup & restore comparaison

you need to dump your tsm backup logs via following command :

# dsmc query backup -subdir=yes -filesonly -detail /archives/ > query_backup.log

after you created the log file, you could run the following script to check your restore quality.

#### change logs
# 2017/07/23, v3 created by paul shen
# 2017/07/31, v4 modified by sam
#
#### you need to dump your backup details from tsm
# dsmc query backup -subdir=yes -filesonly -detail /archives/ > query_backup.log
#

WORK_DIR=`pwd`

q_ba_file=${WORK_DIR}/query_backup.log
backup_path=/archives # original backup path
path=${WORK_DIR}/path.out
newpath=${WORK_DIR}/newpath.out
date=${WORK_DIR}/date.out
result=${WORK_DIR}/result.out
exist=${WORK_DIR}/exist.out
dont_exist=${WORK_DIR}/dont_exist.out

cd ${WORK_DIR}
grep Modified ${q_ba_file} |awk '{print $2 "\t" $3}' > ${date}
grep ${backup_path} ${q_ba_file}|cut -c76-999 > ${path}

#### if you restored to other path, you need to modify your new path in order to compare file exist or not
while read line
do
   echo "/NEW_PATH/$line" >> ${newpath}
done < ${path}


sed -i 's/^/"/g' ${newpath}
sed -i 's/$/"/g' ${newpath}
paste -d"\t" ${date} ${newpath} > ${result}


while read line
do
   tmp=$(echo "$line" |awk -F '\t' '{print $3}' )
   path="${tmp:1:${#tmp}-2}"
   if [ -f "$path" ]; then
      echo $line >> ${exist}
   else
      echo $line >> ${dont_exist}
   fi
done < ${result}

Leave a Reply

Your email address will not be published. Required fields are marked *

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.