1825766 Members
2098 Online
109687 Solutions
New Discussion

tar backup

 
Cheung_2
Frequent Advisor

tar backup

I would like to use tar to backup our system, how can I verify whether the backup is successful or not? Thx.
Andy
13 REPLIES 13
Ravi_8
Honored Contributor

Re: tar backup

Hi, guys

Think twice before answering this guy posting.
I never seen this guy assigning point
never give up
Armin Feller
Honored Contributor

Re: tar backup

Hi,

check the syslogfile for error messages during tar process and after creating the tape you can have a look which datas are on the tape by PSEUDO restore:

# tar tv
or
# tar tvf
or
# tar tv > /tmp/index

Regards ...
Armin
M.Kantharuban
Advisor

Re: tar backup

u can list the files from the backup tape u have taken by
'tar tvf '

see man pages for more details

ruban
Jose Mosquera
Honored Contributor

Re: tar backup

Hi,

Always that a unix command have been executed return a code, if this code is cero (0) this mean that have been successfully, other code means non-successfully execution status. This return code is stored in $? environment variable, to answer for this do:

tar
if [$? -eq 0 ]
then
echo "tar successfully"
else
echo "tar have warnings or errors"
fi


Rgds.
Jose Mosquera
Honored Contributor

Re: tar backup

Hi,

Always that a unix command have been executed return a code, if this code is cero (0) this mean that have been successfully, other code means non-successfully execution status. This return code is stored in $? environment variable, to answer for this do:

tar
if [ $? -eq 0 ]
then
echo "tar successfully"
else
echo "tar have warnings or errors"
fi


Rgds.
Cheung_2
Frequent Advisor

Re: tar backup

hi Jose Maria Mosquera ,

thx r reply, i hv tried r script, but it pop up the below the message everytime "./c: [0: command not found
tar have warnings or errors" , can suggest how to fix it ? thx.
Andy
Jochen Heuer
Respected Contributor

Re: tar backup

Hi Cheung,

maybe this helps:

http://66.216.15.50/ITRCForumsEtiquette/
Well, yeah ... I suppose there's no point in getting greedy, is there?
Jose Mosquera
Honored Contributor

Re: tar backup

Hi,

Really, I've tried and work fine, pls take note about my last reply wherw "if" statament have a space, this is teh correct sintax:

tar
if [ $? -eq 0 ] <-- correction!
then
echo "tar successfully"
else
echo "tar have warnings or errors"
fi

Rgds, and tell me about!
Jochen Heuer
Respected Contributor

Re: tar backup

You can also try this:

$ tar cvf /archive.tar files || echo "tar failed"
Well, yeah ... I suppose there's no point in getting greedy, is there?
harry d brown jr
Honored Contributor

Re: tar backup

Cheung,

You should take care of this:

This member has assigned points to 98 of 186 responses to his/her questions.

You can find your previous posts in your profile:

http://forums.itrc.hp.com/cm/TopSolutions/1,,CA877098!1!questions,00.html

It's pathetic that you have to be continously reminded!

live free or die
harry
Live Free or Die
Shannon Petry
Honored Contributor

Re: tar backup

First, you can use the return code. Maks sure that you can manyally run the tar backup, then do this.

TAR="tar cvf /dev/rmt/0m *"

if `$TAR` ; then
echo "backup worked"
sles
echo "backup failed"
fi

This gets harder depending on what your doing, but return codes are the best indicators whether a command has failed.

Regards,
Shannon
Microsoft. When do you want a virus today?
Steven E. Protter
Exalted Contributor

Re: tar backup

Just to pile on.

don't think using tar as a backup will let you recover a HP-UX system.

to do that, you need an ignite backup

make_tape_recovery

Then if you have the latests tar patch, you can make a massive tarball including files up to 8G in the tar.

Or you could use omniback or fbackup to make a second usaable tape.

I try not to post the same question twice. Though I've been guilty of occasionally not searching before posting, at least I have a 100% record of handing out points on my question.

Please Cheung, be a little nicer to your peers and reward them when they help you. The ettiquette link and Mr. Brown's post deserve 10 points for reminding you to be a responsible poster. Frankly anyone that bothers to post an answer should at least get one point.

I have used answers to my own questions to cut and paste solutions on numerious occaisions, and thats really the way to go.

Lets be friends and come up with new problems that strain our brains to come up with answers.

These forums are NO substitute for a support contract, though I frequently go here first just to have a chance to interact with my peers. I guess I kind of like them.

These forums can be a substitute for hp education, but really if you want to do the job right, you need SysAdmin I and II.

A man page goes a long way towards solving these kind of problems. HP has MUCH better man pages than Linux.

Lets all be friends now.

Regards,

Steve

Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Frank Slootweg
Honored Contributor

Re: tar backup

In general, outside the scope of Ignite-UX, tar(1) is not intended for and is inappropriate for system backup. At least use fbackup(1M), for example via SAM, or preferably a modern day backup product like HP's OmniBack.