- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: query on tar command
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
Discussions
Discussions
Forums
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
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
тАО07-13-2007 08:45 PM
тАО07-13-2007 08:45 PM
Can please tell me how to extract tar backup by extracting files without extracting leading directories. For example, to recover
/prod/applprod/test.txt to /test/applprod, I want tar to extract only test.txt to /test/applprod instead of the whole directory structure /prod/applprod/test.txt
thank you
Solved! Go to Solution.
- Tags:
- tar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2007 09:04 PM
тАО07-13-2007 09:04 PM
Re: query on tar command
To be able to extract to a location different than from where you took the backup usingtar - needs backup to be taken with relative path names rather than absolute path names.
Thus if you have take tar like e.g.
tar cvf xyz.tar ./prod/*
Only then you can goto some other directory and extract it there using tar xvf .
Next - if you want to extract only a particular file - then as er your e.g.
cd /test/applprod
tar xvf xyz.tar /prod/applprod/test.txt
But again as I said earlier only if you have taken backup using relative names, then would you be able to extract it to /test/applprod , not otherwise.
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-13-2007 09:11 PM
тАО07-13-2007 09:11 PM
Re: query on tar command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2007 01:27 AM
тАО07-14-2007 01:27 AM
Re: query on tar command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2007 03:49 AM
- Tags:
- foreign devil tools
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-14-2007 08:31 AM
тАО07-14-2007 08:31 AM
Re: query on tar command
Sorry, probably I did not interpret you question correctly.
As Dennis suggested, you can use pax to extract the file you want and to a directory other than from where you backed it up, as below
pax -r -d -s ',/prod/applprod/,/test/applprod/,' -f xyz.tar /prod/applprod/test.txt
Regards,
Ninad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-15-2007 02:21 PM
тАО07-15-2007 02:21 PM
Re: query on tar command
Example 1 (can restore to other directory; no full path is needed as backup is not taken at full path)
During backup
# cd /home/user1
# tar cvf /dev/rmt/0m color1
During recover
# cd /tmp
# tar xvf /dev/rmt/0m color1
Example 2 (restore required full path as backup was taken in full path)
During backup
# tar cvf /dev/rmt/0m /home/user1/color1
During restore
# tar xvf /dev/rmt/0m /home/user1/color1
Hope this make a clear difference.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-15-2007 02:29 PM
тАО07-15-2007 02:29 PM
Re: query on tar command
This is true if you just use the standard tar. But as I said, you can tar with absolute path and use pax to restore to any path.
# cd /home/user1
# tar cvf /dev/rmt/0m color1
You can also optimize this by:
# tar cvf /dev/rmt/0m -C /home/user1 color1
(Multiple -C paths are possible.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2007 04:29 PM
тАО07-29-2007 04:29 PM
Re: query on tar command
1. I do the backup on *.tmp
on /prod/applprod/prodora/8.0.6
- cd /prod/applprod/prodora/8.0.6
- tar -cvf /u01/123.tar -i *.tmp
2. I verify my backup by :
tamcoapp:/u01# tar -tvf /u01/123.tar
rw-rw-rw- 0/3 0 Jul 30 10:02 2007 alson.tmp
rwxr-xr-x 108/102 2251 Jun 11 11:54 2002 forms60.csh.tmp
rwxr-xr-x 108/102 2796 Jun 11 11:54 2002 forms60.sh.tmp
rwxr-xr-x 108/102 5565 Jun 11 11:54 2002 forms60_server.tmp
rwxr-xr-x 108/102 2371 Jun 11 11:54 2002 reports60.csh.tmp
rwxr-xr-x 108/102 2897 Jun 11 11:54 2002 reports60.sh.tmp
rwxr-xr-x 108/102 3139 Jun 11 11:54 2002 reports60_server.tmp
2. then I restore it in u01/applhprod/hprodora/8.0.6
app:#/u01/applhprod/hprodora/8.0.6/pax -r -d -s ',/prod/applprod/prodora/8.0.6/,/u01/applhprod/hprodora/8.0.6/,' -f /u01/123.tar /prod/applprod/prodora/8.0.6/*.tmp
And I get this error message :
tamcoapp:/u01/applhprod/hprodora/8.0.6# a/8.0.6/alson.tmp not found in archive <
pax: /prod/applprod/prodora/8.0.6/alson.tmp not found in archive
pax: /prod/applprod/prodora/8.0.6/forms60.csh.tmp not found in archive
pax: /prod/applprod/prodora/8.0.6/forms60.sh.tmp not found in archive
pax: /prod/applprod/prodora/8.0.6/forms60_server.tmp not found in archive
pax: /prod/applprod/prodora/8.0.6/reports60.csh.tmp not found in archive
pax: /prod/applprod/prodora/8.0.6/reports60.sh.tmp not found in archive
pax: /prod/applprod/prodora/8.0.6/reports60_server.tmp not found in archive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-29-2007 04:52 PM
тАО07-29-2007 04:52 PM
Re: query on tar command
not quoted:
/prod/applprod/prodora/8.0.6/*.tmp
Try quoting it, or, better yet, leave it out.
Everything in your archive is a *.tmp. If
you specify no pattern, you should get
everything in the archive, which would seem
to be what you want.