- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- TAR command options
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
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
тАО12-18-2003 12:16 AM
тАО12-18-2003 12:16 AM
a very simple question:
I need to know the options to create an archive by the TAR command and to keep the files absolute pathname; I need also to know if/how is possible to restore an archive containing files in absolute pathname on an a specific directory in relative format, i.e.
tar ... /tmp/pippo/..... -> /tmp/pippo/ fileas are archived
tar xvf .... on /usr/ directory -> /usr/tmp/pippo/ files are extracted
thanks
Enrico
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 12:20 AM
тАО12-18-2003 12:20 AM
Re: TAR command options
"tar cvf /dev/rmt/0mn /usr /home etc"
There is no way to restore these to relative directories if using standard HP-UX tar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 12:21 AM
тАО12-18-2003 12:21 AM
Re: TAR command options
To keep absolute pathname, then just create the tar with that path - Ex:
tar cvf /path/to/file.tar /path/to/1stfile /path/to/2ndfile /path/to/3rdfile etc.
To extract this to a relative path you can't use the standard tar. Have to use a command like pax & I *think* GNU tar (gtar) can do this, but not positive.
Rgds,
Jeff
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 12:34 AM
тАО12-18-2003 12:34 AM
Re: TAR command options
to create an archive:
tar cvf /ABSOLUTEPATH/FILENAME.tar
AFAIK once the tar is created with absolute pathnames you have NO WAY to revert it to relative, so it is always advisable to use a relative one.
There would be a workaround, but i do not think that you want to mess up with chroot ....
Massimo
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 12:39 AM
тАО12-18-2003 12:39 AM
Re: TAR command options
tar xvf
mv /usr/tmp/usr /usr/tmp/pippo
(Haven't test this, but it should work.)
Unless I misunderstand, and you want only the files in /usr from a tarfile containing more. In that case you need to list the files you want to retrieve at the end of the command line, but this can give problems too many arguments. pax is then the way to go, and can also sove your directory-name-change problem with a rewrite rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 01:08 AM
тАО12-18-2003 01:08 AM
Re: TAR command options
If you absolutely must restore something stored with absolute paths to a different directory, have a look at the 'pax' command. It does have the ability to do what you want. ('man pax' for more info.)
Something else you could do in your case is store the files as ./tmp/pippo (tar -cvf /dev/rmt/??? ./tmp/pippo) This would still give you your /tmp dirnmae, but make restoring much easier.
You could then do: cd /usr ; tar -xvf /dev/rmt/??? ./tmp/pippo
Good Luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 02:19 AM
тАО12-18-2003 02:19 AM
Re: TAR command options
tar cvf /path/files.tar /path/files_to_tar
...to restore
take a look to this attach!
Hope this helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 07:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-18-2003 08:53 AM
тАО12-18-2003 08:53 AM
Re: TAR command options
As long as you use HP tar, the recommendation is to always use relative paths. For example:
cd / && tar c ./the/path/you/want
Until you've recycled all of your tapes with absolute paths, the only option you have for recovery is setup the target path for chroot.
In HP-UX 11.x, this should work:
mkdir /target/path
cd /target/path
mkdir bin lib
cp /usr/bin/tar bin
cp /usr/lib/{dld,libdld,libc}.sl lib
If tar were a static binary, this would have been more trivial.
You do not need to copy any tar files to this location if you plan to use standard input.
If you need access to a tape device, eg /dev/rmt/0m, then create the device file:
mkdir -p dev/rmt
mknod dev/rmt/0m c major minor
where the major and minor numbers are taken from ls -l /dev/rmt/0m. For example, on my system: mknod dev/rmt/0m c 205 0x041000
Then extract the archive via stdin this way (The only required absolute path here is /usr/bin/tar because chroot does not look in PATH for to find commands.):
su root -c "/usr/sbin/chroot /target/path /usr/bin/tar xf - < /path/to/tarfile"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2003 12:22 AM
тАО12-19-2003 12:22 AM
Re: TAR command options
To your point on tar not being static. You are partically correct, the tar program in /usr/bin is dynamically linked, however, there is a static version of the tar command in /sbin. For that matter, all of the commands in /sbin are statically linked.
JL
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-19-2003 12:02 PM
тАО12-19-2003 12:02 PM