Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...This is a very good site. Please keep it running. Thanks and wishing a great health and success for the site and its owners..."

Geography

Where in the world do Tek-Tips members come from?
frumpus (Programmer)
9 Jun 11 17:45
We are setting up a new server and before we get too far we want to test a backup and restore. I don't have the tape drive in yet, so I backed the system up to the hard drive in a tar file (uncompressed.)

Now I want to restore it to a temp directory I've created just to make sure we can do that and that everything is there.

I am attempting to do so with this command:

CODE

sudo tar -xvf /rman/test_restore/full_backup_09-JUN-2011 /rman/backup_initial_full/full_backup.tar

/rman/test_restore/full_backup_09-JUN-2011 is a directory I created to restore the tar into.

When I try to run this I get the error:

CODE

tar: /rman/test_restore/full_backup_09-JUN-2011: Cannot read: Is a directory

Then it gives up. Did I leave something out to tell it that yes that is a directory and that's where I want it to put the files? I don't want to randomly try things and overwrite the existing system so I need to get this right.
Helpful Member!  Annihilannic (MIS)
10 Jun 11 1:13
You are providing the directory as a parameter to the -f option, which is expecting the tar file.

Try this:

CODE

tar -xvf /rman/backup_initial_full/full_backup.tar -C /rman/test_restore/full_backup_09-JUN-2011

Or this:

CODE

tar -xvfC /rman/backup_initial_full/full_backup.tar /rman/test_restore/full_backup_09-JUN-2011

The latter demonstrates tar's weird behaviour of accepting parameters to its options (in the same order) after all of the options have been specified.

Annihilannic.

KenCunningham (TechnicalUser)
10 Jun 11 3:58
A word of warning - watch out for absolute pathnames when playing with tar!

The internet - allowing those who don't know what they're talking about to have their say.

frumpus (Programmer)
10 Jun 11 11:12
That worked, thanks!
frumpus (Programmer)
10 Jun 11 11:13
Ken, would you elaborate on that a bit? What am I watching out for?
KenCunningham (TechnicalUser)
13 Jun 11 5:25
Hi. Apologies - the weekend intervened! Basically, tar normally writes files with the absolute pathname - ie the full /back/to/root path. When these are restored using tar, they are written to the exact place they were written from, and sometimes this is not desirable (for example if one wants to compare an older copy of a file with the current one).

To avoid this you can use pax:

CODE

pax -r -s,/export/home/users,/export/home/users2, -f /tmp/users.tar

will extract files from users.tar changing /export/home/users to /export/home/users2

Hope this helps.

 

The internet - allowing those who don't know what they're talking about to have their say.

KenCunningham (TechnicalUser)
13 Jun 11 5:31
Hi Frumpus. Just remembered that we're dealing with Linux here, not Solaris, so it could be that your tar (possibly GNU?) will exhibit different behaviour. To find out, use:

tar -tvf filename.tar

just to list the files in the archive (and how they are referenced) rather than actually extract them. Apologies for any confusion!

The internet - allowing those who don't know what they're talking about to have their say.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close