Link to home
Start Free TrialLog in
Avatar of kls1
kls1

asked on

Tar and Tapes - -Problems Extracting and Getting a Listing of Files

I'm working on what I thought was something pretty basic:

- Tar a file to a mounted tape drive
- Get a listing of the files on the tape drive
- Extract the file just tarred from the tape drive

I can get the file, I think tarred to the tape drive since when I do a

mt -f /dev/nst0 status

I the file count increments.

Beyond that, I'm lost. None of the following works:

tar -tvf /dev/nst0
tar -tv /dev/nst0
tar -xvf /dev/nst0
tar -xv  /dev/nst0
tar -xvf /dev/nst0 *

Here's an example of the command and the errors I'm getting:
tar -tvf /dev/nst0
tar: /dev/nst0: Cannot read: Input/output error
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now

sudo tar -xvf /dev/nst0 test1
tar: /dev/nst0: Cannot read: Input/output error
tar: At beginning of tape, quitting now
tar: Error is not recoverable: exiting now

tar -xvf /dev/nst0
[yields nothing]

This works fine:

tar -cvf /dev/nst0 test1                                            
test1/
test1/temp2
test1/temp1
test1/temp3
test1/temp4



Avatar of Tintin
Tintin

nst0 is the no rewind device.  This allows you to add multiple backups to a single tape.  Is that what you are doing?

What does

tar tvf /dev/st0

return?

Do you rewind the tape before tarring up the files?

Sounds like what you really want is:

tar cvf /dev/st0 test1
tar tvf /dev/st0
tar xvf /dev/st0
Avatar of kls1

ASKER

I have it to the point to where I can actually get it to add/archive a directory, show a listing, and extract *one* set of files. But, the file counter always shows 0.  


mt -f /dev/st0 status
SCSI 2 tape drive:
File number=0, block number=0, partition=0.
Tape block size 0 bytes. Density code 0x42 (no translation).
Soft error count since last status=0
General status bits on (41010000):
 BOT ONLINE IM_REP_EN


What might I be doing to prevent me from adding more than one archive? (It copies over the previous one when I add a new one) I tried

mt -f /dev/st0 fsf 1

It doesn't seem to change anything.

For a tvf:

tar tvf /dev/st0
drwxr-xr-x jjj/users      0 2006-05-31 08:23:00 test5/
-rw-r--r-- jjj/usersf    15 2006-05-31 08:23:00 test5/temp2
-rw-r--r-- jjj/users     15 2006-05-31 08:23:00 test5/temp1
-rw-r--r-- jjj/users     15 2006-05-31 08:23:00 test5/temp3
-rw-r--r-- jjj/users     15 2006-05-31 08:23:00 test5/temp4

i

ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kls1

ASKER

Ok, so it sounds like what is confusing me is when to use the no-rewind device and when not to.

So do I understand correctly that using st0 as the device name will automatically rewind the tape after any operation. Whereas using nst0 will not?

I notice that you use st0 in the first command you list, but nst0 for the remaining. Why do you use st0 in the first command? Would it matter which device name you used in the first command?
You are correct in your summation of st0 and nst0

Strictly speaking, doing

mt -f /dev/st0 rewind

is a bit redundant as you rightly point out st0 is the rewind device, so any operations on it will rewind the tape.  However, it makes it very clear as to what you are doing, so it doesn't hurt.
Avatar of kls1

ASKER

Ok, sounds great -- thanks!