- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 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-02-2005 09:05 AM
06-02-2005 09:05 AM
Tar question
Thanks - Angie
- Tags:
- tar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 09:07 AM
06-02-2005 09:07 AM
Re: Tar question
cd to desired source dir:
find . -print | cpio -pudvm /xxx/yyy/zzz where /xxx/yyy/zzz is the destination directory/filesystem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 09:08 AM
06-02-2005 09:08 AM
Re: Tar question
Anil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 09:11 AM
06-02-2005 09:11 AM
Re: Tar question
On the SOURCE system:
# cd /dir
# tar -cf - . | remsh DESTINATION "cd /dest_dir ; tar -xf -"
This could also be done if you have SSH access between the 2 systems.
# cd /dir
# tar -cf - . | ssh DESTINATION "cd /dest_dir ; tar -xf -"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 09:14 AM
06-02-2005 09:14 AM
Re: Tar question
Both NFS filesystems are mounted on this server.
So I need to tar up a directory on one filesystem and untar it to the other location.
So is this below correct? Why the "-" after "-cvf" and "-xvf"?
Angie
tar -cvf - /source_dir/file1 /source_dir/file2 | (cd /dest;tar -xvf -)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 09:17 AM
06-02-2005 09:17 AM
Re: Tar question
Not quite but very close. You want to cd into the source directory; otherwise, you'll end up with /dest/source_dir/file# instead of /dest/file#.
So, the full, correct syntax:
cd /source
tar -cf - . | (cd /dest; tar -xf -)
Without the -v, you won't see the file names as they get processed. If you want to see them, put the -v in one and only one of the tar commands, otherwise you'll see the filenames twice...
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 09:24 AM
06-02-2005 09:24 AM
Re: Tar question
Thank you for clarifying.
Now one last question... to find out how much was tarred/untarred... is there a simple way to do this (in megs)? Or how do you get the results at the end?
Angie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 02:01 PM
06-02-2005 02:01 PM
Re: Tar question
If you were creating a regular tar ball, you could simply examine the size of the resulting file. In this case, since you're immediately extracting the tar, the best easiest way would be to simply:
du -sk /dest
That will give the size of the resulting dest dir in K; divide by 1024 to get megs.
BTW, to answer your other question that I missed -f - means to create the tar file to standard out or extract it from standard in.
HTH;
Doug
------
Senior UNIX Admin
O'Leary Computers Inc
linkedin: http://www.linkedin.com/dkoleary
Resume: http://www.olearycomputers.com/resume.html
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2005 06:42 PM
06-02-2005 06:42 PM
Re: Tar question
All the answers given (except the remsh and ssh one's), cd to the source dir, and then write to the dest dir, probably assuming the server you work on is the one that has the dest dir mounted NFS
It will be extremely much faster -- if the NFS is two way -- to do this on the receiving server, where the source dir is on the mounted NFS. Read ops don't lock as much as write ops, and locking is the most expensive NFS operation.
my options:
1. ssh
2. remsh
3. rcp (make a tar on machine 1, untar on machine 2)
4. NFS
Then as last tip, you can speed up the extraction by adding a dd to better stream the data, where dd just acts as a buffer
# cd dest
# ( cd source ; tar cf - . ) | dd | tar xvf -
Do not use -v on both ends. Then you will get all the files listed twice
Enjoy, Have FUN! H.Merijn