The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-05-2005
Registered User
 

Join Date: Sep 2005
Posts: 85
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Help with TAR

Hi,
I tarred some files off to a tape. I'm trying to restore them now.
Am I missing a step?

1) I rewind the tape.
2) I did a tar -tvf and saw the file on the tape.
3) I do a tar -xvf <file_name> that was shown from the tar -tvf

Is this all I need to do to restore the file? Just trying to make sure I have the command right before issuing it, the file is very very large.

Thanks!
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 12-05-2005
Registered User
 

Join Date: Feb 2005
Location: Broomfield, CO
Posts: 363
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
<filename> is the device you're restoring data from when you supply the 'f' switch. The default device is /dev/rmt/0 on sun, /dev/sa0 on OS X, and /dev/rmt0 on linux so if you remove the 'f' parameter, the command would extract from the default device and would look like:

tar vx [filename]

If it's a different device

tar xvf [device] [filename]

Carl
Reply With Quote
  #3 (permalink)  
Old 12-06-2005
Registered User
 

Join Date: Dec 2005
Posts: 1
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Some more tar parameters

You may also want to pay attention to some other parameters of tar. You must include one of these actions:

x=Extract contents
t=List contents
c=Create

Then there is the:
v=verbose which echos the results to the standard output (screen)

If if you specify:
f=file If "f" is specified, the next parameter must be the device or file of the archive. If no "f" is specified, the default device ( sometimes specified in /etc/defaults/tar ) will be used.

So tar -xvf <file> <path/files> or -cvf <file> <path/files> or tar -tvf <file> are the most common.

You may also want to pay attention to the file attributes and how to handle duplicates and paths that do not exist. Each OS may have minor differences so read the man page for that OS.
Reply With Quote
  #4 (permalink)  
Old 12-07-2005
Registered User
 

Join Date: Sep 2005
Posts: 85
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
RE: Help with TAR

I have a bunch of tar'red files on a tape.

I'm trying to restore them to disk.

I've read the MAN pages and some googled sites, but I'm still confused:

I run the tar -xvf /dev/rmt/2un <file_name>
command and it restores the files.

But, how do I know which tar file is next on the tape? If I do a tar -tvf, it is past the point on the tape of the file right? Is there any way to do a tar -tvf and then rewind JUST 1 TAR file back so that I can then restore it?

Thanks!
Reply With Quote
  #5 (permalink)  
Old 12-07-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,253
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
You know what's on the tape because you are the guy who wrote stuff to the tape. When that does not work, I take one pass though the tape mapping it out, then I rewind it and restore on the second pass. There are commands like "mt bsf 2", but I don't think it's worth it.
Reply With Quote
  #6 (permalink)  
Old 12-08-2005
Registered User
 

Join Date: Sep 2005
Posts: 85
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
I know what's on the tape, I just don't know the order of what's on the tape unfortunately

When you say you take a pass through the tape "mapping" out what's on the tape, do you mean you just do repetitive tar -tvf commands?

Thanks for the help!
Reply With Quote
  #7 (permalink)  
Old 12-08-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,253
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Quote:
Originally Posted by FredSmith
When you say you take a pass through the tape "mapping" out what's on the tape, do you mean you just do repetitive tar -tvf commands?
AHA! A trick question! Only if the tape is in tar format.
Reply With Quote
Google UNIX.COM
Reply

Tags
linux

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash exec bash for loop close_wait command copy/move folder in unix couldn't set locale correctly curses.h cut command in unix dead.letter find grep find null character in a unix file grep multiple lines grep or grep recursive inaddr_any inappropriate ioctl for device ksh if logrotate.conf lynx javascript mailx attachment mget mtime ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute vi+substitute+end+of+line+character while loop within while loop shell script


All times are GMT -7. The time now is 07:21 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101