Operating System - HP-UX
1758503 Members
2517 Online
108871 Solutions
New Discussion юеВ

Re: Multiples backup on DTL tape

 
MR VILLOT   MR MONTAGNE
Frequent Advisor

Multiples backup on DTL tape

Hi,

I would like to know which is the best way to backup the same directories on DLT tape.
I need to append data to the same backup tape.

What i think to do is :
# cd /backup_directory
#(tar cvf - my_directory | gzip -c > data.tar.gz) > data.log 2 >&1
# dd if=data.tar.gz of=/dev/rmt/c7t1d0BEST 1024

but I am not sure to not remove the last backup.
I know it is possible to use SAM to automate backup.

Thanks for your help
Regards

Laurent
9 REPLIES 9
RAC_1
Honored Contributor

Re: Multiples backup on DTL tape

Look at the tar option u. It updates the file at the end of the achieve if file has been modified since it was backed up last.
Also you can user no rewind device each time you run tar.

tar -cvf /dev/rmt/0m "files"
For next backup
mt -f /dev/rmt/0m fsf 1
tar -cvf /dev/rmt/0mn "file"

Backups products like OB, Veritas netbackup, legato can do this vey easily.

Anil
There is no substitute to HARDWORK
Fred Ruffet
Honored Contributor

Re: Multiples backup on DTL tape

devices not ending by n char are rewinded at end of operation. So if you don't keep a log of last written position, you will write each time at start and overwrite.

Some possibilities :
. keep a trace of how many blocks your dd said it writes and place yourself at the right place
. Have a distinct file name each time and use tar rvf (append mode)
. use fbackup (that's the tool sam uses)

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
MR VILLOT   MR MONTAGNE
Frequent Advisor

Re: Multiples backup on DTL tape

Thanks,

RAC, I tried your commands with two different directories to backup.
When I do tar -tv, I do not see the first backup.
I tried :
# mt -f /dev/rmt/0m bsf 1
# tar -tv
but only second backup is available...

How can I check if my first backup is available on my DLT and how can I restore it ?

Fred Ruffet
Honored Contributor

Re: Multiples backup on DTL tape

making 2 backups whith Omn device, you are at end of second backup. Using "mt ... bsf 1" you go back to start of second backup. "mt ... bsf 2" (or "mt ... bsf 1" twice) would have bring you back to first one.

Even if it work, you should really have a look at fbackup, because, unless you have GNU tar, you will not be able to backup largefiles with tar.

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
MR VILLOT   MR MONTAGNE
Frequent Advisor

Re: Multiples backup on DTL tape

fred,
I always tried mt with bsf 2 but tar -tv doesn't show data from first backup.

For fbackup, I do not think it is good solution because it is not possible to have several backups on the same tape. fbackup removes the last backup I believe.

Another solution is :

# tar cvf - my_directory > my_directory.tar

# tar cv my_directory.tar (first backup)
# tar rv my_directory.tar (second directory)
Fred Ruffet
Honored Contributor

Re: Multiples backup on DTL tape

r option : "This option cannot be used if the archive is a tape." (man tar)

You will have to use u option.
As I said, problem with tar uvf is that you will need to give a different name to the file you add (newer version of files may not be appended or will replace old ones).

Regards,

Fred
--

"Reality is just a point of view." (P. K. D.)
John Palmer
Honored Contributor

Re: Multiples backup on DTL tape

When you have several files stored on a tape, you have to understand the tape structure and how mt fsf and bsf commands work.

Each file is followed by a special block called a 'tape mark', end of tape (on HP-UX) is normally indicated by a double tape mark.

Therefore a tape with three (for instance tar) files has the following structure...
TMTMTMTM
where TM is a Tape Mark.

mt fsf and bsf skips the requested number of tape marks and leaves the tape positioned after the tape mark IN THE DIRECTION OF TAPE TRAVEL. Thus mt fsf will leave you positioned after a tape mark (at the start of the next file) but mt bsf leaves you BEFORE the tape mark.

If you therefore always rewind the tape and mt fsf the required number of files you will have no problem.

If you use mt bsf then try to read a file (tar tvf for instance) it will always read the tape mark and report an empty file (unless you are at the beginning of the tape). In your case, having done mt bsf 2, you need to run mt fsf 1 then run tar (or run tar twice, which has the same effect).

Regards,
John
A. Clay Stephenson
Acclaimed Contributor

Re: Multiples backup on DTL tape

I would also suggest that you use the Berkeley-style no-rewind devices. ie those that end in "mnb". The Berkeley vs. AT&T styles determine how no-rewind devices behave position the tape after closing the file. The Berkeley style is much more logical and I say this having grown up in AT&T (the real stuff) UNIX. Man 7 mt for details on the differences.
If it ain't broke, I can fix that.

Re: Multiples backup on DTL tape

1. To append files to a tape with existing filesets, you need to forward the tape to the end of the filesets first:

mt -t fsf

(Make sure is the non-rewind device file, and n is the number of the filesets which are on the tape).
2. Then copy your files to tape:

tar cvf

NOTE: To rewind your tape to the beginning, use:

mt -t rew

( should be rewind device file)


regards
SK
Your imagination is the preview of your life's coming attractions