- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: 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
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
02-04-2003 08:13 AM
02-04-2003 08:13 AM
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:19 AM
02-04-2003 08:19 AM
Re: tar command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:20 AM
02-04-2003 08:20 AM
Re: tar command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:21 AM
02-04-2003 08:21 AM
Re: tar command
# tar -cvf /dev/rmt/0m /
You can replace /dev/rmt/0m with any other file name too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:22 AM
02-04-2003 08:22 AM
Re: tar command
if you want to restore absolute TAR or CPIO archive to relative directory you have to use PAX.
Please see:
# man pax
e.g.
# cd $HOME
# pax -r -s ',^/,,' -f /dev/rmt/0m -t
Regards ...
Armin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:22 AM
02-04-2003 08:22 AM
Re: tar command
The bad news is that all files will have an absolute path which will make restoring files to other locations difficult. My preference would be
HERE=$(pwd)
cd /
tar cvf /dev/rmt/3m .
cd ${HERE}
so that everything is tar'ed with relative paths and then restores to / or to another location are trivially easy.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:23 AM
02-04-2003 08:23 AM
Re: tar command
For example:
tar cvf /dev/rmt/0m /etc
When you specify a full path name from root for the directory (ie: it stars with /), it will do what you want.
Good luck!
Vince
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:26 AM
02-04-2003 08:26 AM
Re: tar command
tar -cf - / | ssh hostname dd of=/dev/rmt/0m
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:30 AM
02-04-2003 08:30 AM
Re: tar command
If I understand your question correctly, you want to tar up an archive containing files in a directory other than the one you are in right now.
eg.
cd /home/root
tar -cvf /tmp/test.tar /home/bob
This will work, however when extracting it will recreate the directory structure relative to where you are (Reference many, many ITRC Forums postings on this issue).
If you don't want this, but don't want to do a Change Directory, use the '-C' option on tar.
Share and Enjoy! Ian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2003 08:33 AM
02-04-2003 08:33 AM
Re: tar command
The tar command has always as the first argument what you want it to do..
-c = create
-x = extract
-t = view contents
-r = add to current archive
The -v option is verbose, meaning you will see everything that tar does. This may not be critical for you, as failures will come on screen without the -v option.
The -f option means that you are specifiying a file/device for the archive, as opposed to using the system default "/dev/tape".
The tar command has the following format.
tar
Unix can understand many switches in a single string. I.E.
tar -c -v -f
is the same as...
tar -cvf
When creating a tar file, you must have a file list. This can be any string space separated as long as your total command does not extend past about 4K characters.
tar -cf /home/me/backup.tar /usr /opt /var
would create a file in your home that was a tar archive of /usr, /opt, and /var.
I would recommend this over backing up "/", as you will not be needing most of the contents of /tmp, /var/tmp, and can get in trouble with things like /dev if your system configuration changes.