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
- 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
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
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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?
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.
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.
ASKER
Ok, sounds great -- thanks!
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