Skip to content
July 3, 2010 / doganay

ASM HEADER BACKUP SCRIPT

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
Hi,
It’s important to backup asm disk headers, you may want to to it using a shell script, here:
#!/bin/ksh
# Backup ASM Disk Header by doganay
## You may want to change this directory according to your need
disk_dir=/dev/rdisk*
out_dir=ANY_DIRECTORY_YOU_WANT
###### Clean old backups
if [ -d “$out_dir” ]; then
find $out_dir/ -mtime +7 -exec rm -f {} \;
else
echo “Output Directory does not exist”
exit
fi
vdate=`date ‘+%d%m%y’`
for i in `ls $disk_dir`
do
dsk=`echo $i| awk -F\/ ‘{print $3}’`
####### TEST dsk variable, in some circumstances, you may use this:
####### dsk=`echo $i| awk -F\/ ‘{print $4}’`
####### Yeah, in the end, we copy the first 4096 bytes of the disks using dd
dd if=$i of=$out_dir/$dsk”_”$vdate”.dd” bs=4096 count=1
done
try and pray 🙂
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: