- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- How to use TAR to restore files in a different pla...
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
10-21-2004 03:04 AM
10-21-2004 03:04 AM
How to use TAR to restore files in a different place.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:09 AM
10-21-2004 03:09 AM
Re: How to use TAR to restore files in a different place.
cd /etc ; tar cvf fred.tar .
rather than
tar cvf fred.tar /etc
In the latter case, files will be stored as /etc/hosts, /etc/passwd etc, whereas in the former they will be ./passwd, ./hosts etc, meaning they can be restored anyway.
tar tvf fred.tar will show you whether the tar is relative or absolute. If filenames are prefixed with ./ then it's relative and you're fine.
If it's an absolute tar, you only have 2 options - tar through symbolic links, or create a chroot jail.
In the first case, it depends what you are restoring, and whether you can rename things out of the way. If you can create a symbolic link where the directory would be to where you want it to, you're set. If not then: -
The other option is a chroot jail. Basically you need to create a small environment somewhere, eg under /var/tmp/jail, under which you'll need the tar binary, libc libraries, a shell etc. Then chroot to this, and you can then untar under this.
It's messy, its complicated, but it makes you quickly realise the benefit of relative pathed tars ;)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:10 AM
10-21-2004 03:10 AM
Re: How to use TAR to restore files in a different place.
cd /
tar cvf /tmp/sometarfile.tar home
then cd /tmp
tar xvf sometarfile.tar
that will dump archive of home all to tmp...
Rgds...Geoff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:11 AM
10-21-2004 03:11 AM
Re: How to use TAR to restore files in a different place.
If you used absolute path names (begins with "/"), then either use gnu tar or use the "pax" command.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:12 AM
10-21-2004 03:12 AM
Re: How to use TAR to restore files in a different place.
you can use pax to do that,
http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&docId=200000062772639
The itrc doc id is UBACKKBRC00008718
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:12 AM
10-21-2004 03:12 AM
Re: How to use TAR to restore files in a different place.
-C directory name causes tar to chdir and unarchive relative to that location.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:14 AM
10-21-2004 03:14 AM
Re: How to use TAR to restore files in a different place.
BUT, you have following options.
1. Use GNU tar. Get it from http://hpux.connect.org.uk. You need to know block size
of hp's tar.
2. Use pax as follows.
pax -rv -s '/^\///' < tar_file
3. Use of chroot. This did not work for me. Try it.
/usr/bin/cp /usr/sbin/static/tar /tmp
/usr/bin/dd if=file.tar | /usr/bin/chroot /tmp ./tar xf -
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:17 AM
10-21-2004 03:17 AM
Re: How to use TAR to restore files in a different place.
Lets say you have a tar which contains a set of database files, eg /u01/oradata/db/system.dbf etc etc
To restore this to /u01/oradata, you would do: -
mkdir /u02/jail
cd /u02/jail
cp /sbin/tar /sbin/ls /sbin/sh . (you don't need libraries as these are statically linked)
cp /your/tar/file . (if you want to restore from tape, copy the device eg cp -r /dev/rmt/0mn .)
chroot /u02/jail sh (you are now in the jail)
./ls -l (./ needed as no path defined)
./tar cvf tarfile_or_devicename
This will then untar under the chroot, which will put the files under /u02/jail/u01/oradata etc. You can then exit the shell and move the files as required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-21-2004 03:24 AM
10-21-2004 03:24 AM
Re: How to use TAR to restore files in a different place.
I think the "-C" option is for only backing up, not restoring.
HTH
-- Rod Hills