- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: tar question
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:18 AM
06-21-2000 09:18 AM
I have a tar file and would like to restore it. i use the command tar -xv. But this tries to restore it to the original location. Can I tell tar to restore the files to another location (directory) on the system?
Thank you for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:22 AM
06-21-2000 09:22 AM
Re: tar question
man tar to find the options you would need
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:32 AM
06-21-2000 09:32 AM
Re: tar question
That option did not work. I tried that and looked at the man page and there is no reference to restoring to a specified directory or none that I could find.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:41 AM
06-21-2000 09:41 AM
Re: tar question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:45 AM
06-21-2000 09:45 AM
Re: tar question
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:49 AM
06-21-2000 09:49 AM
Re: tar question
Do a "tar -tvf" and capture the output. If the filenames begin ./ , then the restore will be relative to the directory you are in when doing the "un-tar". If the filenames begin with / , then the restore will always be relative to /(root). You can't change this behaviour. Tar is an old utility but useful because all unix OSes have it.
Richard Lathom
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 09:54 AM
06-21-2000 09:54 AM
Re: tar question
Just as I had surmised. So, when I create the tar how do I create it to use relative file names? My tar right now has absolute paths in it.
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 10:20 AM
06-21-2000 10:20 AM
Re: tar question
Firstly, you can recover your existing tar backups. You can use 'pax'. It can recover absolute tar backups, relatively.
To do you tar back relative do :-
tar cvf /dev/rmt/0m ./etc ./usr
or
tar cvf /dev/rmt/0m .
which will backup everything from where your current directory is.
The important thing is to being everything with './'
Andy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2000 10:27 AM
06-21-2000 10:27 AM
Solutionex:
cd /where/I/want/it
tar vxf /wpath/to/tar/file
If the tar was created using absolute paths, I do not believe there is a way to override it in the tar command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2000 01:06 AM
06-22-2000 01:06 AM
Re: tar question
Pax command allows conversion of absolute paths to relative paths using -s option. Pax can read tar files.
This is the only way i know in HP-UX...
but in a SCO you can do tar xvfA. 'A' option converts form absolute to relative paths.
Well, when i must do this in HP-UX i use symbolic links:
if i must restore files under /dir/data:
mv /dir/data /dir/data.o
mkdir /tmp/data
ln -s /tmp/data /dir/data
tar xvf ....
rm /dir/data
mv /dir/data.o /dir/data
So i can extract to /tmp.
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-22-2000 03:02 AM
06-22-2000 03:02 AM
Re: tar question
i think the best solution is to use pax:
pax -rv -s'/^BACKSLASH///'
This will restore the archive into the current directory (look out for pwd).
I have noticed that the Backslash is not submitted by the reply so i have written it symbolic (BACKSLASH). Of course you must use the Backslash key by entering the command.
Greetings
Andrew
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2000 11:41 AM
06-26-2000 11:41 AM
Re: tar question
You just 'cd' to the directory where you want the tar to begin. For example, if you have the following:
/usr/local/bin/etc....
If you want to tar everything in bin, including the bin directory:
cd /usr/local
tar cvf tarfile
The files in the tarfile will look like this:
bin/script1
bin/script2
bin/data
...etc
Then you can restore it anywhere you like:
cd /home/fred
tar xvf tarfile
...will create a 'bin' directory under 'fred'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2000 11:46 AM
06-26-2000 11:46 AM
Re: tar question
You just 'cd' to the directory where you want the tar to begin. For example, if you have the following:
/usr/local/bin/etc....
If you want to tar everything in bin, including the bin directory:
cd /usr/local
tar cvf tarfile
The files in the tarfile will look like this:
bin/script1
bin/script2
bin/data
...etc
Then you can restore it anywhere you like:
cd /home/fred
tar xvf tarfile
...will create a 'bin' directory under 'fred'