9/11/2012

HP-UX TAR tricks & tips

HP-UX technical tips for system administrators

This is how to tar a bunch of files and send it over network to another machine over SSH, in one turn:
# cd /etc; tar cf - passwd | ssh hp01a01.w1 "cd /root;tar xf - passwd"
 Note that with tar you must always use 
relative path, anyway the files on the target system will be extracted 
with fullpath and the original files will be overwritten. GNU tar also offers some options
 which allow the user to modify/transform the paths when files are 
extracted. You can find the GNU tar on HP-UX under the name gtar, you 
can download it from the HP-UX porting center:
# which gtar /usr/local/bin/gtar #
 f you have a ‘tar’ archive that was made with absolute paths, use ‘pax’ to extract it to a different directory:
# pax -r -s '|/tmp/|/opt/|' -f test.tar
If you unpack this archive with other user privileges (non-root) all 
uid and gid will be replaced with the uid and gid from this user. Keep 
that in mind, if you make backups/restore, practically always do any 
backup/restore with UID 0.
The use of tar with find isn’t apt to work if there are lots of files. Instead use pax(1):

# find . -atime +7 | pax -w | gzip > backup.tgz

No comments:

Post a Comment

Popular Posts