- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Why does tar not work?
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
тАО04-06-2004 03:51 AM
тАО04-06-2004 03:51 AM
I need to create a tar archive using a combination of find, xargs, and tar. E.g.
find tmp | xargs tar fcv tmp.tar
(Assume some more options of find for filtering purposes.)
find produces an output of several hundred paths. All these files shall be put into one tar archive "tmp.tar". But this does not work. Although, I do not get an error message, the resulting tar archive never reflects the paths delivered by the find process.
I tried some other variants:
% tar fc tmp.tar `find tmp`
% tar fc tmp.tar any_file
% find tmp | xargs -n 10 tar fr tmp.tar
% tar fc tmp.tar any_file
% find tmp -exec tar fr tmp.tar {} \;
Nothing works. What is going wrong? What is the solution?
(Is it time to change from HP-UX 11.00 to Linux?)
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 03:57 AM
тАО04-06-2004 03:57 AM
Re: Why does tar not work?
Your 'f' option should immediately preceed the name of the file you are taring t.
# tar -cvf tmp.tar filenames
So in your examples:
# find tmp | xargs tar cvf tmp.tar -
Note the '-' at the end of the tar command as well. That tells tar to read the file names from standard input.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 03:57 AM
тАО04-06-2004 03:57 AM
Re: Why does tar not work?
or find /tmp | xargs tar -fcv tmp.tar
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:04 AM
тАО04-06-2004 04:04 AM
Re: Why does tar not work?
the command works for me. I just ran the command that thomas has mentioned and got a tar file. What is the error you are getting. Hope you are not running out on filesystem space.
Hope this helps.
Regds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:09 AM
тАО04-06-2004 04:09 AM
Re: Why does tar not work?
unfortunately, there's no effect using '-' or using it not. Again, no error message, but:
% find tmp | xargs tar cvf tmp.tar -
% find tmp | wc
336 337 8656
% tar ft tmp.tar | wc
35 35 675
(Using xargs, '-' should be obsolete.)
Something is going wrong here. I assume, it has something to do with LINE_MAX, see xargs(1) and limits(5).
But, what is the work-around?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:14 AM
тАО04-06-2004 04:14 AM
Re: Why does tar not work?
thank you for your test; no, file space is ok.
Please, see my answer to Patrick. Would you, please, again do the test with some hundreds of files, and, say about, 50 MB?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:15 AM
тАО04-06-2004 04:15 AM
Re: Why does tar not work?
works for me here, provided I'm in the correct directory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:19 AM
тАО04-06-2004 04:19 AM
Re: Why does tar not work?
please, do following test:
% find dir | xargs tar cvf dirnam.tar
% find dir | wc
output??
% tar ft dirnam.tar | wc
output??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:24 AM
тАО04-06-2004 04:24 AM
Re: Why does tar not work?
Again, the 'f' (file) option should come right before the filename:
% tar tf dirnam.tar | wc
Looks to me like this is consistently your issue...
Jason
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-06-2004 04:26 AM
тАО04-06-2004 04:26 AM
Re: Why does tar not work?
79 633 6292
root@hp19rm4 [/tmp]
# find /home/mfstrong | wc
105 106 3789
hmm I see your point.