AIX & TAR related stuff


 
Thread Tools Search this Thread
Operating Systems AIX AIX & TAR related stuff
# 8  
Old 02-24-2013
Quote:
Originally Posted by MichaelFelt
but it used to be if you restored a file using tar all the zero bytes that are not on disk actually get written to the "tape" AND these zero bytes get restored. (so called sparse files getting backed up and restored as "full" files.
This is true. From the AIX 6.1 manual:

Quote:
tar does not preserve the sparse nature of any file that is sparsely allocated. Any file that was originally sparse before the restoration will have all space allocated within the filesystem for the size of the file.
IMHO "tar" is a good device to bundle some files up to an archive. If one wants to bundle the source files for a software project or to create a snapshot of ones HOME-directory it is a tool worth considering. "tar" plays in the same league as "cpio", "pax" and probably some other tools, "backup" among them.

As Michael hinted at "tar" is platform-independent to a quite unparalleled degree. This is as much an advantage as it is a limiting factor because of some limitations. And for system-wide backups i would use "mksysb" and "savevg" solely under AIX - neither "tar" nor any of the other aforementioned programs.

Just my 2 cents.

bakunin
This User Gave Thanks to bakunin For This Post:
# 9  
Old 02-24-2013
Quote:
Originally Posted by bakunin
As Michael hinted at "tar" is platform-independent to a quite unparalleled degree.
tar is a lot like ps. Both tools are universally deployed, but if you cross platforms, only the most fundamental options will work. Attempt something non-trivial and any semblance of platform-independence evaporates.

Regards,
Alister
This User Gave Thanks to alister For This Post:
# 10  
Old 02-24-2013
As Alister (amck?) has said above, the problem with tar is that it has been implemented so often and so variously that options taken for granted in the GNU world aren't available everywhere.

However the GNU solution has (OS regardless) become the most useful solution and (in my opinion) the solution to a deficiency in your local tar is to install gnu tar(personal opinion, your mileage may vary, I'm right but you don't realise it yet(there's a culture ship name in there (though that'd be a cool culture ship name in its own right))
# 11  
Old 02-28-2013
10. Tar and ZIP the directory in one command

Code:
# tar cvf -  /oracle | gzip > /backup/oracle_backup.tgz
or
# tar cvf - /oracle | gzip > /oracle.tar.gz

If you are using GNU tar , you can say instead:
# tar cvzf oracle.tar.gz /oracle

v enables verbose out and is not necessary for the command to function. 
'f' states that the output is to go to a file that then is set to '-' 
(stdout) making tar write its output to stdout which is the default behavior without both 'f' and '-'.
# tar c /oracle | gzip > oracle.tar.gz

11. unTar and uncompress unZIP the directory in one command

Code:
gunzip < /backup/oracle_backup.tgz | tar -xvf -

OR
gunzip < /oracle/abc.tar.gz | tar xvf -

bzip2 < /oracle/abc.tar.bz2 | tar xvf -


12. Removing leading `/' from member names
sometimes
Code:
tar -cvf -  /oracle | gzip > /backup/oracle_backup.tgz
tar: Removing leading `/' from member names

which means:
1. warning message to tell you that it is writing a tar file without absolute paths.
This is because you cannot then relocate the data at a later date when you un-archive the file.
2. tar takes relative paths. The file paths in a tar archive are stored as relative paths for a good reason.
It gives you more flexibility about where to restore files. You may want to restore files into another location.
The relative path makes this possible.

See more here:
1. http://javarevisited.blogspot.com/20...x-example.html
2. http://shellscriptclub.blogspot.com/...mands-for.html
3. http://www.commandlinefu.com/commands/using/tar

Last edited by filosophizer; 09-19-2013 at 07:25 AM..
# 12  
Old 04-07-2013
13. Tar and ZIP -- multiple directories in one command

we have directories
/oracle
/oracle1
/oracle2

Code:
tar -cvf -  /oracle /oracle1 /oracle2 | gzip > /backup/oracle_backup.tgz



14. unTar and unZIP -- one specific directory from the tar archive in one command

Can someone help with this one. How to untar unzip from oracle_backup.tgz one specific folder which is oracle2 ?

thanks
# 13  
Old 04-08-2013
Quote:
Originally Posted by filosophizer
unTar and unZIP -- one specific directory from the tar archive in one command
gzip -cd <file> unzips from a file to <stdout> This data stream can be fed to "tar".

tar -x <dir> extracts <dir> and all files containing it from a tar archive.

Hence:

Code:
gzip -cd oracle_backup.tgz | tar -xf - /oracle2

I hope this helps.

bakunin
# 14  
Old 08-28-2013
zip and tar size compressed check

15. How to find the total size of the uncompressed tar zipped file oraclebackup.tgz

oraclebackup.tgz was created using the following command, which gave me 40GB file

Code:
# /opt/freeware/bin/tar -cvf -  /oracle | gzip > /backup/oraclebackup.tgz

Now, if someone wants to check how much space is needed to untar and uncompress the file oraclebackup.tgz how can he check ?

thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

GNU TAR vs NATIVE AIX TAR

Hello, Getting this very strange error, made tar/zip through gnu tar GNU Tar ( successful tar and zip without any errors ) /opt/freeware/bin/tar cvf - /oraapp| gzip > /backup/bkp_15_6_16_oraapp.tgz GNU unTar error root@test8:/>gunzip < /config1/bkp_15_6_16_oraapp.tgz |... (5 Replies)
Discussion started by: filosophizer
5 Replies

2. Shell Programming and Scripting

help with tar & zip only last months(say,Sep) files

Need to 1. archive all the files in a directory from the previous month into a tar/gz file, ignoring all already archived 'tar.gz' files 2. Check created .tar.gz file isnt corrupted and has all the required files in it. and then remove the original files. I am using a function to get the... (1 Reply)
Discussion started by: Prev
1 Replies

3. AIX

How to upgrade AIX Firmware & TL Maintenance Level in AIX

Steps to upgrade AIX TL ( technology Level ) / Maintenance Level in AIX ( including Firmware HMC VIOS ) This article or post covers upgrades for - Hardware Management Console ( HMC ) - Firmware ( also known as microcode ) - VIO ( Virtual I/O Server = PowerVM ) - AIX Version, Technology... (2 Replies)
Discussion started by: filosophizer
2 Replies

4. Solaris

Few things related to HBA port & fcinfo command

Hi Gurus I need to know few things related to HBA port & fcinfo command I have a server where there are 4 HBA ports cards are their. Out of 4 ports 2 are in use & 2 are not in use when I check it physicall. Now I want to know the command through which I can get information about all above... (6 Replies)
Discussion started by: girish.batra
6 Replies

5. Shell Programming and Scripting

How to compare 2 files & get only few columns based on a condition related to both files?

Hiiiii friends I have 2 files which contains huge data & few lines of it are as shown below File1: b.dat(which has 21 columns) SSR 1976 8 12 13 10 44.00 39.0700 70.7800 7.0 0 0.00 0 2.78 0.00 0.00 0 0.00 2.78 0 NULL ISC 1976 8 12 22 32 37.39 36.2942 70.7338... (6 Replies)
Discussion started by: reva
6 Replies

6. Solaris

Tar & Tape drive without media

Hi all, I would like to know what would happen if the tape (media) is not placed on the drive and a tar command is executed to backup on the tape. My problem is that tar command hanged for multiple days instead of throwing the error, Is it valid behaviour? I was unable to test the... (4 Replies)
Discussion started by: jmsathish
4 Replies

7. UNIX for Dummies Questions & Answers

tar & Grep together

Hi, I've got dozens of tar's with two files in each one, live_access_log & live_error_log (one tar for each day, backups). The probelm is i need to match a pattern in all of the archive_access_log files and output the line to a seperate file (All_access.log). I.e. I need to get details... (21 Replies)
Discussion started by: tom123
21 Replies

8. UNIX for Dummies Questions & Answers

disaster recover w/tar & find

Hi, I am creating a disaster recovery plan for my Linux 7.2 machine. I have two backups from my current machine. One created using the command tar -cvpf /dev/st0 --exclude=/proc --directory / . and one created with the command find / /boot /home -mount -path '/proc' -prune -o -print |... (4 Replies)
Discussion started by: jeremiebarber
4 Replies

9. UNIX for Dummies Questions & Answers

/dev/hd* ?? & HTFS .... What is this stuff?

# grep "Jul 3" syslog.messages | more Jul 3 00:16:03 www3 CPU3: NOTICE: HTFS: No space on dev hd (1/42) Jul 3 00:16:08 www3 CPU3: NOTICE: HTFS: No space on dev hd (1/42) Jul 3 00:17:01 www3 CPU2: NOTICE: HTFS: No space on dev hd (1/42) Jul 3 00:17:06 www3 syslogd: /usr/adm/debug: No space... (1 Reply)
Discussion started by: Cameron
1 Replies

10. Shell Programming and Scripting

Find & tar execution problem

I'm trying to set up a stanard sh script that will find all the files that have been changed within the last day and then tar them up. I think the command line should be something like : find /home/bob -atime +0 -exec \ tar cvf /home/bob/files.tar {}\; Help please ... Thanx (3 Replies)
Discussion started by: ianf
3 Replies
Login or Register to Ask a Question