Archive

Archive for March, 2012

restore or recovery backup files catalog from symantec netbackup

March 31st, 2012 No comments

1.How to restore files/catalog from symantec netbackup

On the Client, here we take testserver_bak as example
cat /usr/openv/netbackup/bp.conf
SERVER = testmedia1
SERVER = testmedia2
SERVER = testmedia3

CLIENT_NAME = testserver_bak

Then Login to the media server testmedia1, and check the backup.
bplist -C testserver_bak -b -l /export/home/zones/testserver_bak/root/export/home/oracle/arch_mon_main2.sh
-rwxr–r– oracle dba 1213 Feb 13 18:08 /export/home/zones/testserver_bak/root/export/home/oracle/arch_mon_main2.sh
-rwxr–r– oracle dba 1213 Feb 06 18:40 /export/home/zones/testserver_bak/root/export/home/oracle/arch_mon_main2.sh

To restore file/folder from netbackup server side:
bprestore -D testserver_bak -C testserver_bak -L /tmp/restore_log /export/home/zones/testserver_bak/root/export/home/oracle/arch_mon_main2.sh

To restore file/folder from client side:
/usr/openv/netbackup/bin/bprestore -L /tmp/restor_log /export/home/zones/testserver_bak/root/export/home/oracle/arch_mon_main2.sh

You even can specify exact dates for restoration (to restore data from specific date), -s means start date and -e – end date:
/usr/openv/netbackup/bin/bprestore -s 03/13/2012 -e 03/13/2012 -L /tmp/restor_log /apps/kua/
Successful start of restore procedure can be verified with /tmp/restor_log
Restore started 03/27/2012 12:41:33
12:41:40 (3082842.xxx) Restore job id 3082842 will require 1 image.
12:41:40 (3082842.xxx) Media id A06957 is needed for the restore.
12:42:46 (3082842.001) Restoring from image created Tue Mar 13 16:29:32 2012
12:45:13 (3082842.001) TAR STARTED
12:45:13 (3082842.001) INF – If Media id A06957 is not in a robotic library administrative interaction may be required to satisfy this mount request.
12:47:07 (3082842.001) INF – Waiting for mount of media id A06957 on server testmedia1 for reading.
12:48:44 (3082842.001) INF – Waiting for positioning of media id A06957 on server testmedia1 for reading.
12:50:12 (3082842.001) INF – Beginning restore from server testmedia1 to client testserver_bak.

2.Some other useful symantec netbackup commands

Find the correct backup images

bpimagelist -U -client <CLIENT> -d <STARTDATE> -e <ENDDATE>

Find the media used for those images

bpimagelist -U -client <CLIENT> -d <STARTDATE> -e <ENDDATE> -media

Examples
testserver:root root # bpimagelist -U -client testserver_bak -d 03/01/2012 -e 03/23/2012
Backed Up Expires Files KB C Sched Type Policy
—————- ———- ——– ——– – ———— ————
03/22/2012 16:18 04/05/2012 146 116419 N Differential Linux_FS_TUE
03/21/2012 16:01 04/04/2012 150 115169 N Differential Linux_FS_TUE
03/20/2012 16:23 05/21/2012 146441 3834626 N Full Backup Linux_FS_TUE
03/19/2012 16:11 04/02/2012 127 111931 N Differential Linux_FS_TUE
03/18/2012 16:08 04/01/2012 143 113053 N Differential Linux_FS_TUE
03/17/2012 16:08 03/31/2012 128 113245 N Differential Linux_FS_TUE
03/16/2012 16:16 03/30/2012 1593 239091 N Differential Linux_FS_TUE
03/15/2012 16:16 03/29/2012 340 150502 N Differential Linux_FS_TUE
03/14/2012 16:13 03/28/2012 135 114239 N Differential Linux_FS_TUE
03/13/2012 16:29 05/14/2012 238178 13223523 N Full Backup Linux_FS_TUE
03/12/2012 16:08 03/26/2012 119 112315 N Differential Linux_FS_TUE
03/11/2012 16:08 03/25/2012 130 111193 N Differential Linux_FS_TUE
03/10/2012 16:13 03/24/2012 121 112892 N Differential Linux_FS_TUE
03/09/2012 16:20 03/23/2012 125 111418 N Differential Linux_FS_TUE
03/06/2012 16:23 05/14/2013 238164 13208390 N Full Backup Linux_FS_TUE

testserver:root root # bpimagelist -U -client testserver_bak -d 03/13/2012 -e 03/13/2012 -media
Media ID Last Written Server
——– —————- ———-
A06957 03/13/2012 16:29 testmedia1
Checking Drive Usage

You can verify tape drives usage on netbackup server with this command
/usr/openv/volmgr/bin/vmoprcmd

Check the Netbackup jobs.
bpdbjobs -report | grep -i testserver_bak

Check job status
bpdbjobs -report -jobid 6813593
bpdbjobs -most_columns > /tmp/bpdbjobs.out

Check active jobs for node
bpdbjobs | grep testserver_bak | grep -i active

Check backup policy
bppllist -byclient testserver_bak_bak

How to check needed tape is in library
When tape is in library
bash-3.00$ /usr/openv/volmgr/bin/vmquery -m A06957
media ID: A06957
media type: 1/2″ cartridge tape 3 (24)
barcode: A06957L3
media description: –
volume pool: Onsite (4)
robot type: TLD – Tape Library DLT
robot number: 0
robot slot: 374
robot control host: testserver
volume group: 000_00000_TLD
vault name: Vault
vault sent date: Wed Mar 14 11:08:26 2012
vault return date: —
vault slot: 5562
vault session id: 1508
vault container id: -
created: Fri Apr 30 10:56:25 2010
assigned: Sat Mar 10 23:00:13 2012
last mounted: Tue Mar 13 11:55:07 2012
first mount: Sat May 01 02:01:57 2010
expiration date: —
number of mounts: 135
max mounts allowed: —
status: 0×0

When tape is not in library
bash-3.00$ /usr/openv/volmgr/bin/vmquery -m A00006
media ID: A00006
media type: 1/2″ cartridge tape 3 (24)
barcode: A00006L3
media description: –
volume pool: Onsite (4)
robot type: NONE – Not Robotic
volume group: Vaulted_Offsite
vault name: Vault
vault sent date: Mon Feb 06 11:36:59 2012
vault return date: —
vault slot: 149
vault session id: 1480
vault container id: -
created: Wed Feb 27 13:54:54 2008
assigned: Thu Feb 02 18:18:14 2012
last mounted: Thu Feb 02 21:31:14 2012
first mount: Mon Mar 03 22:23:07 2008
expiration date: —
number of mounts: 971
max mounts allowed: —
status: 0×0

You can find more info here http://www.bettssoftware.com/docs/tips-netbackup.html

Categories: Storage Tags:

resolved linux check qlogic/emulex hba firmware version and model name type howto

March 28th, 2012 1 comment

Here’s a script to check linux hba model name, firmware version:

#!/bin/ksh
for SCSI in `ls -d /sys/class/scsi_host/host*`;
do
[ -e ${SCSI}/modelname ] && echo -n ‘Model Name ‘ && cat ${SCSI}/modelname;
[ -e ${SCSI}/model_name ] && echo -n ‘Model Name ‘ && cat ${SCSI}/model_name;
[ -e ${SCSI}/fwrev ] && echo -n ‘Firmware Version ‘ && cat ${SCSI}/fwrev;
[ -e ${SCSI}/fw_version ] && echo -n ‘Firmware Version ‘ && cat ${SCSI}/fw_version;
done

Also here’s a script for you if you’re checking bunches of servers:

#!/bin/ksh
USERNAME=”root”
PASSWORD=”yourpassword”
for i in `cat /home/doxer/servers_list_linux`
do
echo “”>/root/.ssh/known_hosts
expect <<EOF
spawn ssh -l${USERNAME} -p22 $i “echo -n ‘====’;hostname;cat /sys/class/scsi_host/host*/{modelname,model_name,fwrev,fw_version}”
set timeout 20
expect “*yes*”
send “yes\r”
expect “assword:”
send “${PASSWORD}\r”
expect eof
EOF
done

For solaris(solaris10), please refer to the following:

#!/bin/ksh
USERNAME=”root”
PASSWORD=”yourpassword”
for i in `cat servers_list_solaris`
do
echo “”>/root/.ssh/known_hosts
expect <<EOF
spawn ssh -l${USERNAME} -p22 $i “hostname;echo ‘result from prtdiag -v’;/usr/sbin/prtdiag -v|grep PCI;echo ‘result from cfgadm -la|grep fabric’;/usr/sbin/cfgadm -la|grep fabric;echo ‘result from fcinfo hba-port’;/usr/sbin/fcinfo hba-port -l|egrep ‘OS Device Name|HBA Port WWN|Manufacturer|Firmware’;echo ‘result from prtpicl -v -c scsi-fcp’;/usr/sbin/prtpicl -v -c scsi-fcp|egrep ‘version|name’”
set timeout 20
expect “*yes*”
send “yes\r”
expect “assword:”
send “${PASSWORD}\r”
expect eof
EOF
done

For solaris 9:

#!/bin/ksh
USERNAME=”root”
PASSWORD=”yourpassword”
for i in `cat servers_list_solaris`
do
echo “”>/root/.ssh/known_hosts
expect <<EOF
spawn ssh -l${USERNAME} -p22 $i “hostname;echo ‘result from prtdiag -v’;/usr/sbin/prtdiag -v|grep PCI;echo ‘result from cfgadm -la|grep fabric’;/usr/sbin/cfgadm -la|grep fabric;echo ‘result from prtpicl -v -c scsi-fcp’;/usr/sbin/prtpicl -v -c scsi-fcp|egrep ‘version|name’”
set timeout 20
expect “*yes*”
send “yes\r”
expect “assword:”
send “${PASSWORD}\r”
expect eof
EOF
done

And if you found the model is like 375-3102-xx or so, then you can just search it in google, you’ll find this one is qlogic X6767A. If the result is like “driver-name   qlc”, “version       ISP2312 Host Adapter fcode version 1.16 11/15/06″, then you’ll know it’s HP ISP2312 and firmware version is 1.16.

do not run ifconfig -a IPADDR on solaris or loopback ip address will become weird

March 28th, 2012 No comments

If you run ifconfig -a xxx.xxx.xxx.xxx(means an ip address) on solaris box, you’ll find it will give error message:

ifconfig: SIOCSLIFADDR: lo0: Cannot assign requested address

But actually, this command will set the loopback ip address to the one you designated with your command, which means the loopback address will become the ip address other than 127.0.0.1. This is very bad and many weird problems will occur later on, for example, your ssh connection will drop soon after that.

PS:

I’ve also tested it on Linux box and linux will not set loopback ip address to the one designated with the command, but will give error:

error fetching interface information: Device not found

Anyway, do not run ifconfig -a IPADDR on both linux and solaris, or you’ll find your OS in trouble.

Categories: Linux, Systems Tags:

resolved Disk group has no valid configuration copies

March 27th, 2012 No comments

We met this error message when trying to import testDG:

VxVM vxdg ERROR V-5-1-10978 Disk group testDG: import failed:
Disk group has no valid configuration copies

Here’s the disks belongs to testDG:
root@doxer# vxdisk -eo alldgs list|grep testDG
emc0_0ccb auto:cdsdisk emc0_0ecc testDG online clone_disk sdlw srdf-r2
emc0_0c9d auto:cdsdisk emc00 testDG online clone_disk sdlr srdf-r2
emc0_2abf auto:cdsdisk emc03 testDG online clone_disk sdlo srdf-r2
emc0_2ab7 auto:cdsdisk emc02 testDG online clone_disk sdlj srdf-r2
emc0_2ac7 auto:cdsdisk emc01 testDG online clone_disk sdlp srdf-r2
emc0_2a07 auto:cdsdisk emc04 testDG online clone_disk sdky srdf-r2
emc0_2a17 auto:cdsdisk emc05 testDG online clone_disk sdlc srdf-r2

And after checking disks’ configuration, we found that some disks were in disabled status:
root@doxer# vxdg list testDG
Group: testDG
dgid: 1324379725.160.doxer
import-id: 1024.132
flags: cds
version: 140
alignment: 8192 (bytes)
ssb: on
autotagging: on
detach-policy: global
dg-fail-policy: dgdisable
copies: nconfig=default nlog=default
config: seqno=0.1266 permlen=51360 free=51333 templen=13 loglen=4096
config disk emc0_0ccb copy 1 len=51360 disabled
config disk emc0_0c9d copy 1 len=51360 state=clean online
config disk emc0_2abf copy 1 len=51360 state=clean online
config disk emc0_2ab7 copy 1 len=51360 state=clean online
config disk emc0_2ac7 copy 1 len=51360 state=clean online
config disk emc0_2a07 copy 1 len=51360 state=clean online
config disk emc0_2a17 copy 1 len=51360 disabled
log disk emc0_0ccb copy 1 len=4096 disabled
log disk emc0_0c9d copy 1 len=4096
log disk emc0_2abf copy 1 len=4096
log disk emc0_2ab7 copy 1 len=4096
log disk emc0_2ac7 copy 1 len=4096
log disk emc0_2a07 copy 1 len=4096
log disk emc0_2a17 copy 1 len=4096 disabled

We may re-initialise config copies on two failing disks from known good state but it was quite risky. Actually, this is a bug in this version of Veritas, whereby it identifies some disks as clones, and some as normal disks. By default, Veritas would refuse to import such “mixed” configuration – it only allows all-normal or all-clones DGs. A work-around is to specify the “-o useclonedev=off” flag or clear the “clone_disk” flag from the disks, i.e. vxdisk set $disk clone=off. After that, we can import the DG without failure. (This is only a workaround though, and furthurmore, we need upgrade Veritas Storage Foundation, and fix the disabled config replicas.)

The assumption is that it’s some sort of bug related to the veritas array library that causes the state of the clone flag to be updated in some cases when an srdf failover is initiated. The inconsistent state of the disk group probably arose because of the inconsistent srdf state of the symdg before the failover. This looks to have been caused by someone adding a new disk to the symdg which was not in a synchronised state. This is similar to what we saw yesterday which also had a disk added to it’s config in an srdf split state and I had to run an establish.

Categories: Hardware, Storage Tags:

expr of coreutils and exec eval of bash builtins

March 19th, 2012 No comments

1.expr(Evaluates expressions) is a executable program which belongs to coreutils.

for example:

expr 5 + 1 #returns 6

expr index abcdef a #returns 1

For the full man page of expr, you can try info coreutils expr.

Note:

Other coreutils packages includes:

base64, basename, cat, chcon, chgrp, chmod, chown, chroot, cksum, comm, cp, csplit, cut, date, dd, df, dir, dircolors, dirname, du, echo, env, expand, expr, factor, false, fmt, fold, groups, head, hostid, id, install, join, link, ln, logname, ls, md5sum, mkdir, mkfifo, mknod, mktemp, mv, nice, nl, nohup, nproc, od, paste, pathchk, pinky, pr, printenv, printf, ptx, pwd, readlink, rm, rmdir, runcon, seq, sha1sum, sha224sum, sha256sum, sha384sum, sha512sum, shred, shuf, sleep, sort, split, stat, stdbuf, stty, sum, sync, tac, tail, tee, test, timeout, touch, tr, true, truncate, tsort, tty, uname, unexpand, uniq, unlink, users, vdir, wc, who, whoami, and yes

2.exec & eval

exec and eval are two of  bash builtins.

The typical usage of exec is on some menu-driven UI. For example, you can write a menu-driven program, let’s assume it as menu.viewcards, and then you can put it in the customer’s .bash_profile(bash) or .profile(ksh) the following:

exec menu.viewcards

Now when the customer logs on the shell, that menu will replace the current shell without creating a new process.

And for eval, this is used to execute parameters passed to it. For example:

#cmd=”date –date=\”+ 350 days\”"

#eval $cmd
Mon Mar 4 07:03:22 GMT 2013

Categories: Programming Tags:

zencart make multiple large images instead of thumbnails on product info page

March 18th, 2012 No comments

Firstly, for answer of how to add multiple images on product info page on zencart, please refer to http://tutorials.zen-cart.com/index.php?article=58

Then, if you want to make multiple large images instead of thumbnails on product info page , edit file YourSiteSource/includes/modules/additional_images.php, replace the following lines(First back it up!):

$products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . ‘large/’, $products_image_directory) . str_replace($products_image_extension, ”, $file) . IMAGE_SUFFIX_LARGE . $products_image_extension;
$flag_has_large = file_exists($products_image_large);
$products_image_large = ($flag_has_large ? $products_image_large : $products_image_directory . $file);
$flag_display_large = (IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE == ‘Yes’ || $flag_has_large);
$base_image = $products_image_directory . $file;
$thumb_slashes = zen_image($base_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$large_link = zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, ‘pID=’ . $_GET['products_id'] . ‘&pic=’ . $i . ‘&products_image_large_additional=’ . $products_image_large);

// Link Preparation:
$script_link = ‘<script language=”javascript” type=”text/javascript”><!–’ . “\n” . ‘document.write(\” . ($flag_display_large ? ‘<a href=”javascript:popupWindow(\\\” . $large_link . ‘\\\’)”>’ . $thumb_slashes . ‘<br />’ . TEXT_CLICK_TO_ENLARGE . ‘</a>’ : $thumb_slashes) . ‘\’);’ . “\n” . ‘//–></script>’;

$noscript_link = ‘<noscript>’ . ($flag_display_large ? ‘<a href=”‘ . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, ‘pID=’ . $_GET['products_id'] . ‘&pic=’ . $i . ‘&products_image_large_additional=’ . $products_image_large) . ‘” target=”_blank”>’ . $thumb_regular . ‘<br /><span class=”imgLinkAdditional”>’ . TEXT_CLICK_TO_ENLARGE . ‘</span></a>’ : $thumb_regular ) . ‘</noscript>’;

$alternate_link = ‘<a href=”‘ . $products_image_large . ‘” onclick=”javascript:popupWindow(\”. $large_link . ‘\’) return false;” title=”‘ . $products_name . ‘” target=”_blank”>’ . $thumb_regular . ‘<br />’ . TEXT_CLICK_TO_ENLARGE . ‘</a>’;

$link = $script_link . “\n ” . $noscript_link;
$link = $alternate_link;

to:

/**$products_image_large = str_replace(DIR_WS_IMAGES, DIR_WS_IMAGES . ‘large/’, $products_image_directory) . str_replace($products_image_extension, ”, $file) . IMAGE_SUFFIX_LARGE . $products_image_extension;
$flag_has_large = file_exists($products_image_large);
$products_image_large = ($flag_has_large ? $products_image_large : $products_image_directory . $file);
$flag_display_large = (IMAGE_ADDITIONAL_DISPLAY_LINK_EVEN_WHEN_NO_LARGE == ‘Yes’ || $flag_has_large);
$base_image = $products_image_directory . $file;
$thumb_slashes = zen_image($base_image, addslashes($products_name), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$thumb_regular = zen_image($base_image, $products_name, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT);
$large_link = zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, ‘pID=’ . $_GET['products_id'] . ‘&pic=’ . $i . ‘&products_image_large_additional=’ . $products_image_large);

// Link Preparation:
$script_link = ‘<script language=”javascript” type=”text/javascript”><!–’ . “\n” . ‘document.write(\” . ($flag_display_large ? ‘<a href=”javascript:popupWindow(\\\” . $large_link . ‘\\\’)”>’ . $thumb_slashes . ‘<br />’ . TEXT_CLICK_TO_ENLARGE . ‘</a>’ : $thumb_slashes) . ‘\’);’ . “\n” . ‘//–></script>’;

$noscript_link = ‘<noscript>’ . ($flag_display_large ? ‘<a href=”‘ . zen_href_link(FILENAME_POPUP_IMAGE_ADDITIONAL, ‘pID=’ . $_GET['products_id'] . ‘&pic=’ . $i . ‘&products_image_large_additional=’ . $products_image_large) . ‘” target=”_blank”>’ . $thumb_regular . ‘<br /><span class=”imgLinkAdditional”>’ . TEXT_CLICK_TO_ENLARGE . ‘</span></a>’ : $thumb_regular ) . ‘</noscript>’;

// $alternate_link = ‘<a href=”‘ . $products_image_large . ‘” onclick=”javascript:popupWindow(\”. $large_link . ‘\’) return false;” title=”‘ . $products_name . ‘” target=”_blank”>’ . $thumb_regular . ‘<br />’ . TEXT_CLICK_TO_ENLARGE . ‘</a>’;

$link = $script_link . “\n ” . $noscript_link;
// $link = $alternate_link;
**/

And add line(if you upload large images to main directory):

echo “<img src=\”http://www.YOURSITE.com/images/{$file}\” />”;

before the following line:

// List Box array generation:

Now save and refresh the product info page of zencart, you’ll see the fancy!

Categories: Programming Tags: