Restore files from tape with multiple positions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Restore files from tape with multiple positions
# 1  
Old 10-22-2013
Question Restore files from tape with multiple positions

I have lots of tapes where files got written to X amount of positions per tape.

Is there a way to restore all files on the tape regardless of position ID?

Right now to restore files in the first position I do

Code:
mt -f /dev/nst0 fsf 1
tar -xvf /dev/nst0

I'd really like if there was a script or a command to either loop through all position ID's or simply restore the whole tape. Some tapes appear to have 300+ position ID's.

Thanks for any assistance.

Last edited by Don Cragun; 11-08-2017 at 08:55 PM.. Reason: Add missing CODE tags.
# 2  
Old 10-22-2013
Unfortunately, your method is the safest way. The problem though is the fsf command. So, you can search forward, but I know with many tape drives, you have to go forward, back and then read.

You can put things into a loop for sure, but obviously it will take time.
# 3  
Old 10-22-2013
What happens if you don't use mt and just do tar. Also...some tape control options are based on how you specify your device file, for example on aix rmt0 and rmt0.1 are the same device...see
Rmt0.1 | World is Welcome To The World of Unix!!!
# 4  
Old 10-22-2013
Try this, assumption is that mt returns non-zero when no more positions left on tape.

Code:
echo "Rewinding tape"
mt -f /dev/nst0 rewind
pos=0
while mt -f /dev/nst0 fsf 1
do
   let pos=pos+1
   echo "Extracting from tape position $pos"
   tar -xvf /dev/nst0
done
echo "Rewinding tape"
mt -f /dev/nst0 rewind

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Restore directory and contents from tape

Hi, I have taken a backup of a directory on my tape in using below command cd /backup find * -print|backup -ivf '/dev/rmt0' '-U' |tee -a /syslogs/backup.log and output appear in below format. a 0 rman-before-08032014 a 58403323904... (2 Replies)
Discussion started by: m_raheelahmed
2 Replies

2. Emergency UNIX and Linux Support

Can't restore my deleted etc from tape

Hi I recently deleted my /etc but I had a backup on tape. I was able to boot the server with a cd-rom and mounted the /c1t0d0s0 which is where the root directory resides. However when I tried to restore the backup with tar xvf /dev/rmt/0n I wasn't successful even though I was able to use the tar... (2 Replies)
Discussion started by: rahmantanko
2 Replies

3. Solaris

Solaris 2.6 restore from tape

Hope someone can help me here... I've got to restore an E450 with 300MHz cpus which was running Solaris 2.6 from tape. Regrettably the boot drive has failed. I've access to the first release of Solaris 2.6 CD's and to a set of Solaris 9 CD's. I remember that different E450 CPUs needed different... (1 Reply)
Discussion started by: pamplemousse
1 Replies

4. Solaris

FLAR Tape Backup/Restore

I have a T2000 server that is JumpStarted with Solaris 10 from the JumpStart server. Host name and IP address is changed after that. Then we backup the server using FLAR to tape: root.damas# date; flarcreate -c -t -n "Sol10_cairo_image" -a "engineering@starsolutions.com" -R / /dev/rmt/0n ;... (2 Replies)
Discussion started by: StarSol
2 Replies

5. UNIX for Dummies Questions & Answers

How to extract multiple files from tape

Hello everyone, I am having difficulties restoring data from a tape and I was hoping someone could help me. Here it goes. Whenever I type tar -xvf /dev/nst0, only the first file on the tape is restored which means that in the particular tape there are multiple tar files. Can someone please... (10 Replies)
Discussion started by: goude
10 Replies

6. SCO

Restore from HP Tape Drive

Here is the scenario. We have an billing system that ran on SCO 5.0.6. The HP Netserver went dwon, along with SCSI disks. They are unretrievable. I installed an IDE HDD, and reinstalled SCO. I am not too familiar w/ SCO or UNIX, and need to know how to install Tape drive, and how to restore from... (11 Replies)
Discussion started by: jlewis808
11 Replies

7. AIX

Restore a tape

Hello everyone I have a tape with some information that I got to restore, the tape was made with the fbackup command in a hp box. My question is that I have to restore in a Ibm box, how can I do this ? Thanks in advance (1 Reply)
Discussion started by: lo-lp-kl
1 Replies

8. HP-UX

Backup Tape Restore?

I am trying to do a restore on a backup tape (DDS2) and am having a little trouble. For one, I dont know how the tape was made, whether is was tar, cpio, dump..etc. Anyone know how to restore a tape without knowing the format of the backup? (5 Replies)
Discussion started by: bake255
5 Replies

9. Filesystems, Disks and Memory

Restore to disk from tape

I have been restoring from tape some old data. I have done quite a few tapes and have had no problems until now. The command I am running is "dd if=/dev/rmt/1hbn bs=1024 | tar -pBxF - ". This is the second tape have have come up with the error "Not enough space". This tape has a couple of... (1 Reply)
Discussion started by: mtoombs
1 Replies

10. UNIX for Dummies Questions & Answers

Tape Restore Problems!!!

Hi. I have been having problems with restoring from a tape backup. I use the following cpio command: find / -print | cpio -ouvB > /dev/rStp0 After running this cpio command, the screen will display all files, but when I try to read or restore the tape I get the following error: Tape input... (1 Reply)
Discussion started by: cstovall
1 Replies
Login or Register to Ask a Question