backup

hi seniors today i took a backup using tar cmd in this i took two files for backup,backup was done succesfully but while viewing using tar -tvf ------- its showiing only one file at a time and i took backup in /etc/hosts,/etc/sen/nes

What do you mean by

and please post the working directory and exact command you used when creating the tar.

present dir is /etc/hosts and i put the cmd tar -cvf /dev/rmt0 /etc/hosts and after completion of the work it showing r-rw-r 20 block /etc/hosts and after that i took anothere backup and after that i view the file in the drive
tar -tvf /dev/rmt0

Not sure I understood...
You were in /etc (and not /etc/hosts) but has no impact since you used:

tar -cvf /dev/rmt0 /etc/hosts

Which meant an absolute path.. your second tar was done in replacement of the first I would believe since you didnt use tar append option not moved forward with mt command

I am too lazy to walk to the server room to test it with a tape, but when you write 1 file to tape with tar, and after that another, I guess you just overwrite the 1st or if they are both on the tape, you have to spool around.

Maybe it is more practical to just include all files and dirs you want to backup to tape into 1 tmp directory or give them as parameter to 1 tar and write them to tape in 1 archive instead of one after each other.

[hi friend i got the solution for that for the second(file) backup we have to give the cmd like tar -cvf /dev/rmt0.1 /etc/----- its working try it

This is true, but only in principle. The complete picture is quite more complex because of the somewhat counterintuitive way AIX is dealing with tape-drives:

You sure know that to access the tape you use a device like /dev/rmt0, yes? This is the tape drive in its standard configuration, the attributes shown if you do a "lscfg -vp rmt0" or a "lsattr -El rmt0" respectively.

But you might also have seen device specifications like "/dev/rmt0.1" or such. Have you ever wondered what they stand for? Well, i have not found a complete table up until now, but the principle is: it is the same tapedrive minus selected properties and every sub-number (/dev/rmt0.1, /dev/rmt0.2, etc..) stands for some capability or several capabilities which are "switched off" from the original drive.

Why does that have to do with the posters problem you ask: the standard drives (/dev/rmt0) of all IBM drives i know have an auto-rewind-feature. As soon as the tar output is written to the tape it is rewound back to its beginning. /dev/rmt0.1 (as the poster has found out to use) is the same drive but with this auto-rewind feature switched off.

Btw., there is also another way to navigate your way through a multi-session tape with several entries, like, for instance, an mksysb-tape: use the "tctl" command with the "fsf" subfunction. "fsf" is for "forward skip file" and is followed by a number indicating how many files to skip. For instance to write a file after an already written on use the following:

( tctl fsf 1 ; tar -cvf /dev/rmt0 /path/to/file )

Or, to read the backup of the filesystems in a mksysb tape, which is the fourth file on the tape:

tctl fsf 3 ; tar -tvf /dev/rmt0

I hope this helps.

bakunin

hi friend this is the error which am getting while try to see the file in the drivetctl fsf 2 ; tar -tvf /dev/rmt0
tar: 0511-193 An error occurred while reading from the media.
There is an input or output error