Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem while writing to Tape 1

Status
Not open for further replies.

DivakarG

Programmer
Sep 8, 2002
3
IN
Hi,

I am trying to write 4 files on to a Magnetic tape.
I used Special File names to write data as below:

1) tctl -f /dev/rmt0 rewind
2) tar -cvf /dev/rmt0.3 /temp123/File1
3) tar -cvf /dev/rmt0.2 /temp123/File2
4) tar -cvf /dev/rmt0.2 /temp123/File3
5) tar -cvf /dev/rmt0 /temp123/File4

After completing above activity now whne I do tar -tvf /dev/rmt0 to see the contents of tape,

I only get the name of the File1.

lsattr -l rmt0 -EH

attribute value description user_settable

mode yes Use DEVICE BUFFERS during writes True
block_size 1024 BLOCK size (0=variable length) True
extfm yes Use EXTENDED file marks True
ret no RETENSION on tape change or reset True
density_set_1 38 DENSITY setting #1 True
density_set_2 37 DENSITY setting #2 True
compress yes Use data COMPRESSION True
size_in_mb 20480 Size in Megabytes False
ret_error no RETURN error on tape change or reset True


Am I missingout something. Please advise.

Divakar
 
You should either use rmt0.1 (density setting 1, no rewind on close, no retension) or rmt0.5 (density setting 2, no rewind on close, no retension) consistently when tar-ing like this.


What you now have is the file2, file3 and file4 overwriting the tape over and over again, so I think you see only the last file when reading it back.

1) tctl -f /dev/rmt0 rewind
2) tar -cvf /dev/rmt0.1 /temp123/File1
3) tar -cvf /dev/rmt0.1 /temp123/File2
4) tar -cvf /dev/rmt0.1 /temp123/File3
5) tar -cvf /dev/rmt0.1 /temp123/File4

The last tar operation can use rmt0 because you want to rewind the tape anyway after the last operation.

When reading back, use the same names

1) tctl -f /dev/rmt0 rewind
2) tar -tvf /dev/rmt0.1
3) tar -tvf /dev/rmt0.1
4) tar -tvf /dev/rmt0.1
5) tar -tvf /dev/rmt0

Or you can use tctl fsf 3 -f /dev/rmt0.1 to skip 3 filemarks and read the 4th file

1) tctl -f /dev/rmt0 rewind
2) tctl -f /dev/rmt0.1 fsf 3
3) tar -tvf /dev/rmt0 # read File4

You want to experiment a bit with this before rolling out a backup script in the real world.


Other option is to use one tar command to tar all 4 files into one tape file.

1) tctl -f /dev/rmt0 rewind
2) tar -cvf /dev/rmt0 /temp123/File[1234]



HTH,

p5wizard
 
Thanks for your response.

If there is single command to see all the contents/files in the tape. Something like "ls" in Unix.

After using the commands as below, I could see another file. this means that files have been copied to the Tape.

tctl -f /dev/rmt0.1 fsf 3
tar -tvf /dev/rmt0

I referred to the following link before copying the files.


Divakar
 
tcopy /dev/rmt0

(see man page)

also this should work (but it's a multiliner)

tctl -f /dev/rmt0 rewind
while tar -tvf/dev/rmt0.1 && echo "Next tapefile..." || echo "End of tape reached."
do
:
done


HTH,

p5wizard
 
Thanks Again..
I am yet to try tcopy..I will chek it up in a while. DO I need to change the block size. Its 1024 by default.

Meanwhile I have 2 more questions related to above. It wud be great if you cud respond to this as well.

1) When we copied the file to the Tape we used command as below:

tar -cvf /dev/rmt0 /temp123/backup2/GPIECUS.0.gpiecus.NODE0000.CATN0000.20070123182549.001

When the file got copied to the tape, its name in the Tape was the absolute path that we provided and not the file name only.

test:root:/> tar -tvf /dev/rmt0
-rwxrwxrwx 238 3 2776662016 Jan 23 12:57:53 2007 /temp123/backup2/GPIECUS.0.gpiecus.NODE0000.CATN0000.20070123182549.001

Is there a way to avoid this. I mean we only get the Filename in the Tape also.

2) When we copy such a file (with name as absolute path) where does the file get copied to in the Box. I used command as below:

tar -xvf /dev/rmt0

Thanks!
Divakar
 
With absolute pathnames, restore goes to the exact same file, which is sometimes undesirable...

either this

cd /path/to/that/dir
tar -cvf/dev/rmt0.1 filename_only

or this

tar -cvf/dev/rmt0 -C /path/to/that/dir filename_only

see man page for tar



HTH,

p5wizard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top