Operating System - HP-UX
1837239 Members
1965 Online
110115 Solutions
New Discussion

Backup Script - any ideas

 
Donny Jekels
Respected Contributor

Backup Script - any ideas

I am busy compiling a backup script.

1. I am sending a list of files to be tar'ed to disk then gzip this tar ball.

2. I then use dd or maybe cpio to copy the file to tape

Now what I need to do next is to put EOF stamps on the tape, maybe reserv the tape drive till the next job run.

This is a stand alone tape drive, that I need to automate. but dont want to overwrite files. the tape loaded will be able to take tar files for each day of the week, untill it needs replacement.

What I, need to find out if anyone has done a similar project either in KSH or Perl (these are my languages of choice) to help me under stnad how to eof stamp the tape after the file is copied to the tape, and then reserve the tape till tomorrow and then release it just before the next backup. ???

sound confusing - see attached KSH script - the eof, release and reserve functions is not complete
"Vision, is the art of seeing the invisible"
8 REPLIES 8
James Murtagh
Honored Contributor

Re: Backup Script - any ideas


Hi Donny,

Possibly use the non-rewind device?

i.e.

/dev/rmt/0mn

This will mark an EOF for you.

I would be wary of using the words compile and script in the same question. You'll get all these C programmers throwing all sorts of things at you! :-)

Cheers,

James.
James Murtagh
Honored Contributor

Re: Backup Script - any ideas


OK, being serious now.

I had a look at the script and it is pretty straightforward.

I would use the no-rewind device (which will hold the tape at the point the last backup ends). Also I would put in the script a static variable for the size of the tape you are using, and possibly the compression ratio of the gzip command (by testing). From here you could work out when a tape will need to be changed by the operators?

I don't think you can reserve a drive in a non-shared environment i.e. not on a SAN. (use the st command to do this on a SAN.

Hope this is a bit more help.

Cheers,

James.
Donny Jekels
Respected Contributor

Re: Backup Script - any ideas

Like you said the script is very strait forward. Thanx for the tip on the static variable of the size of the tape. I can work with to determine how full the tape is.

again thanx
"Vision, is the art of seeing the invisible"
A. Clay Stephenson
Acclaimed Contributor

Re: Backup Script - any ideas

I suggest that rather than using 0mn as your nowind device that you instead use 0mnb (the Berkeley style no-rewind device). You will likely experience fewer surprises with tape behavior that way. Man 7 mt for details.
If it ain't broke, I can fix that.
Donny Jekels
Respected Contributor

Re: Backup Script - any ideas

Okay guys.

mt -f /dev/rmt/0 non-rewind
mt -f /dev/rmt/0 no-rewind
mt -f /dev/rmt/0 norewind

none of them work.
checked the man 7 mt pages, there is no non-rewind or no-rewind

>>?????????

"Vision, is the art of seeing the invisible"
A. Clay Stephenson
Acclaimed Contributor

Re: Backup Script - any ideas

No, do an ls -l /dev/rmt

Nm - rewind,best-density
Nmn - norewind,best-density
Nmb - Berkeley-stlye, best density
Nmnb - dest-density, no-rewind, Berkeley-style

It's the device node that you choose.

Man 7 mt for details.
If it ain't broke, I can fix that.
harry d brown jr
Honored Contributor

Re: Backup Script - any ideas


# ls -l /dev/rmt/*n
crw-rw-rw- 2 bin bin 205 0x005040 Aug 14 2001 /dev/rmt/0mn
crw-rw-rw- 2 bin bin 205 0x046040 Aug 13 2001 /dev/rmt/1mn
crw-rw-rw- 2 bin bin 205 0x005040 Aug 14 2001 /dev/rmt/c0t5d0BESTn
crw-rw-rw- 1 bin bin 205 0x005041 Aug 13 2001 /dev/rmt/c0t5d0DDSn
crw-rw-rw- 2 bin bin 205 0x046040 Aug 13 2001 /dev/rmt/c4t6d0BESTn
#


NOT

/dev/rmt/0

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

Re: Backup Script - any ideas

I have a similar solaris script, but running ufsdump.
Primarily, before every backup routine, I to a fast forward of the tape to the last EOD mark.
mt -t /dev/rmt/0mn eod
This is the safety.

Some of your functions are kind of futile. There is no tape lock, nor unlock.. So, the safest thing to do is eject the tape between runs, and make sure your tape is at the end of file mark when you restart the backup.

Last piece of advise for tar backups... It's hard to list the files. What I would do is make a text file and include it with your tarball listing the tarball's contents. Simple to do, and yet gives you a fast way of finding what you need.

Regards,
Shannon
Microsoft. When do you want a virus today?