- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Problems with pax and tar commands
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
03-27-2003 07:37 PM
03-27-2003 07:37 PM
I have a .tar file i.e file.tar which I'm trying to extract into a directory different from original path.
The original paths are:
/cs/home/projects/f1
/cs/home/projects/f2
/cs/home/disks/01
/cs/home/disks/02
using the command, the original paths were tar-ed as:
# tar -cvf file.tar /cs/home/projects/f1
(list continues for the remaining filesystems ...). The filesystems were archived with the absolute paths.
I need to extract the contents of file.tar into /project/restore filesystem.
I tried the following methods:
1)
#cd /project/restore
#tar -xvf file.tar
This caused the archived files to be extracted to its original path i.e. /cs/home/ filesystem area.
2)# cd /project/restore
# pax -r -f file.tar
pax:/cs/home/projects/f1 : The file/directory exists and will not be overwritten.
pax:/cs/home/projects/f2 :The file access permissions do not allow the specified action.
3) #cd /project/restore
#pax -r -s "/cs/project" -f file.tar
pax: 0511-660 A replacement string was not added : Bad delimeters
pax:/cs/home/projects/f1 : The file/directory exists and will not be overwritten.
pax:/cs/home/projects/f2 : The file access permissions do not allow the specified action.
For method (3), I tried reading the archive file.tar with all files rooted in /cs/ in the archive extracted relative to the current directory /project/restore.
Could anyone help me by pointing out where did I go wrong? How should I fix such errors?
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:50 PM
03-27-2003 07:50 PM
Re: Problems with pax and tar commands
There is no way to change a backup restore point on tar is it was backed up using an absolute path.
From the man page:
There is no way to restore an absolute path name to a relative position.
Regards
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:50 PM
03-27-2003 07:50 PM
Solution# cd /project/restore
# pax -r -s ',^/cs/home/,,' -f file.tar -t
==> That will create dirs "projects" and "disks" in /project/restore and extract everything under those dirs.
OR you can run ..
# pax -r -s ',^/cs/home/projects/,,' -f file.tar -t
and
# pax -r -s ',^/cs/home/disks/,,' -f file.tar -t
==> which would create dirs "f1", "f2", "01" and "02" in /project/restore instead and extract everything under those dirs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:54 PM
03-27-2003 07:54 PM
Re: Problems with pax and tar commands
As I see if you can either recreate the tar file using relative path names i.e. cd to the directory first then create the archive. Or take it to another system without the directory tree you have there and extract it then recreate it using relative path name.
Good luck
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 07:57 PM
03-27-2003 07:57 PM
Re: Problems with pax and tar commands
Change directory to where you wish to start:
cd /mydir
# pax -rv -s'/^\///' < file.tar
Failing all of that you could doenload GNU tar from from the porting archive:
http://hpux.connect.org.uk/hppd/hpux/Gnu/tar-1.13.25/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 08:04 PM
03-27-2003 08:04 PM
Re: Problems with pax and tar commands
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 08:50 PM
03-27-2003 08:50 PM
Re: Problems with pax and tar commands
I tried your method:
#cd /project/restore
#pax -rv -s '/^\///'
It extracts the contents of file.tar into the /project/restore/cs/home...
However, it did not preserve the ownerships and permissions of /cs, /cs/home and /cs/home/projects.
I tried doing:
# cd /project/restore
# pax -rv -s '/^\///' -pe < file.tar
I used the -p and -e options to preserve the ownerships and permissions. However, this method seemed to have preserved ownerships and permissions of f1, d1, f2, d2 and not /cs/home/projects/ and /cs/home/disks.
Could you show me how such problems can be fixed?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 09:02 PM
03-27-2003 09:02 PM
Re: Problems with pax and tar commands
there is no way you can restore to some other path , waht can be tried in case you have space is to mount some disk under /cs/home and then restore the data
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 10:02 PM
03-27-2003 10:02 PM
Re: Problems with pax and tar commands
I tried your suggestions:
1)
# cd /project/restore
# pax -r -s ',^/cs/home/,,' -f file.tar -t
pax: /cs/home/projects/f1 : The file or directory exists and will not be overwritten.
pax: /cs/home/projects/f2 : The file access permissions do not allow the specified action.
pax: /cs/home/disks/01 : The file or directory exists and will not be overwritten.
pax: /cs/home/disks/02 : The file or directory exists and will not be overwritten.
2)
# pax -r -s ',^/cs/home/projects/,,' -f file.tar -t
and
# pax -r -s ',^/cs/home/disks/,,' -f file.tar -t
pax: /cs/home/projects/f1 : The file or directory exists and will not be overwritten.
pax: /cs/home/projects/f2 : The file access permissions do not allow the specified action.
pax: /cs/home/disks/01 : The file or directory exists and will not be overwritten.
pax: /cs/home/disks/02 : The file or directory exists and will not be overwritten.
Could you point out to me where did I go wrong?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-27-2003 11:22 PM
03-27-2003 11:22 PM
Re: Problems with pax and tar commands
try this -
1. login or su to root
2. mkdir /dir_to_extract_to (or whatever you decide is appropriate)
3. cd /dir_to_extract_to
4. cp tar binary into /dir_to_extract_to
5. create a device file using mknod into /dir_to_extract_to
6. ls -l /dev/rmt/0m
crw-rw-rw- 2 bin bin 205 0x050000 Jan 21 18:38 /dev/rmt/0m
7. mknod tape c 205 0x050000
8. chroot /dir_to_extract_to ./tar -xvf ./device /dirs_to_restore
- ramd.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2003 04:13 AM
03-28-2003 04:13 AM
Re: Problems with pax and tar commands
But, if these are really only four files, then why don't you interactively rename the paths via the "-i" option?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2003 04:38 AM
03-28-2003 04:38 AM
Re: Problems with pax and tar commands
Prebuilt GNU tar available for 11.00 and 10.20 on my ITRC site https://www.beepz.com/personal/merijn/ or http://www.cmve.net/~merijn/
Enjoy, have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-29-2003 10:29 PM
03-29-2003 10:29 PM
Re: Problems with pax and tar commands
Thanks for the quick alternative/easy solution.
However, when I tried using gtar to un-tar file.tar from the relative position, I was not able to preserve the ownerships of original filesystems that were tar-ed into file.tar.
I tried using the options --same-owner and --preserve-permissions for gtar as follows:
1)
# cd /project/restore
#gtar -xv --same-owner --preserve-permissions -f file.tar
gtar:Cannot chown file cs/home/projects/f1 to uid 977 gid 4:Not owner
(The same error list continues for the remaining filesystems extracted).
2)
#cd /project/restore
# gtar -xv -m -p -f file.tar
Method (2) did not generate the errors as in method (1). However, method (2) did not preserve the ownerships of the files extracted.
Could you kindly point out to me where did I go wrong?
If you're familiar with pax, I'd certainly like to have your input on the usage of pax to preserve the ownerships/permissions.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2003 09:24 AM
03-31-2003 09:24 AM
Re: Problems with pax and tar commands
# cd /tmp
# mkdir tmp
# cd /tmp/tmp
# pwd
/tmp/tmp
# chmod 777 .
# gtar ......
Enjoy, have FUN! H.Merijn