Solved

tar command

Posted on 2004-04-19
15
38,853 Views
Last Modified: 2013-11-17
Hi All,

Our system is AIX 5.1.

1. I wrote a srcipt to tar only FOUR directories:
 
tar -cvf /dev/rmt0.1 / >> /logs/coldbackup
tar -cvf /dev/rmt0.1 /usr >> /logs/coldbackup
tar -cvf /dev/rmt0.1 /var>> /logs/coldbackup
tar -cvf /dev/rmt0.1 /opt >> /logs/coldbackup

However at the end, I found it tar ALL the directories in my system, such as /tmp, /abc, /def, ....etc. So what's the problem? I shouldn't put tar / (root) in the script? if there is alternative method (command) to backup root file system only and exclude any mounted file system and the link to them?

2. I saw there is some limitation on using tar to backup the file size which is bigger than 2 G, so how to solve this?

Thanks

0
Comment
Question by:terrywong
  • 6
  • 4
  • 3
  • +2
15 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10865957
Hi terrywong,

What version of tar are you using ?

tar -cvf <archive name>.tar <directory to archive>

is the normal way of using tar command ... It does not look same to me

For your second problem, I think recompiling your tar program with large file support should solve the problem

Sunnycoder
0
 
LVL 62

Expert Comment

by:gheist
ID: 10865989
AIX has mksysb command, best run for smit, and backup command for other volume groups.
tar is somewhat limited (by posix), same is true about pax or cpio..., and they never back up hdisk5 (boot volume), so you will end up with unusable backup data.

0
 

Author Comment

by:terrywong
ID: 10865990
thank you for the reply.
What I am trying to do is to put all the files into a non-rewind tape drive directly.
tar -cvf <device> <directory to archive> >> logs

Terry
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 62

Expert Comment

by:gheist
ID: 10866003
sunny: wt?.... tar format has 32-bit block counter, any other "support" is non standard.
same about longer file names.
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10866005
I do not think tar produces the archive on atandard output ... You need to specify the filename for the archive (I am not sure if it is the same on AIX) ... try using the format

tar -cvf backup.tar main_dir

and then copy it the tape
0
 
LVL 62

Expert Comment

by:gheist
ID: 10866020
tar cvf - /wherever | gzip -9 | dd of=/dev/rmt0.6

terry: avoid gcc compiler, it does not work with some aix linker versions, gtar or star make tar files which are not correctly processed by system tar, same about sed awk etc tools.
0
 
LVL 45

Expert Comment

by:sunnycoder
ID: 10866025
Gheist I have not used much of unix but loads of linux ... Recent versions of kernels and compilers came out with large file support which allows you to overcome limitation of 2Gb ... This support is standardized for sure ... If you wish to verify, check the man pages for recent releases of glibc (man 2 open for example) ... However for enabling these options to be used, programs need to be compiled for LFS support enabled through compiler switches
0
 
LVL 62

Expert Comment

by:gheist
ID: 10866486
hello - tar format limits block count in file.... large file support enables to create huge tar files
0
 
LVL 20

Expert Comment

by:Gns
ID: 10867432
Sunny, tar will happily write directly to tape. There is no probblem (apart from the obvious need to _exlude_ things instead of _including everything_ a couple of times:-). GNU tar isn't necessarily POSIX, so will "overcome" the POSIX header limitations.
Gheist, for 5.1 the "tar limit" might be 2GiB ("enforeced" in  the tar header), on 5.2 it's up to 8 GiB/archived file... "ustar" header... empirically tested to work too:-).

But the correct answer has already been given (by gheist): You should be using mksysb to back up the rootvg, and possibly backup to dump any othe volume groups. Has the added bonus of drastically simplifying restore.

If for some reason you still want to make a tar dump, you should perhaps look at getting GNU tar, since the OS version will not preserve sparce files (amongst other things)... You can get one prebuilt from http://www.bullfreeware.com/download/aix43/gnu.tar-1.13.0.0.exe (following the 5.1 link, you get the 4.3 one. Go figure:).
You might want to explore the possibilitys of the -C and --one-file-system with that one... Removes the need to create "exlude lists".

-- Glenn
0
 
LVL 62

Accepted Solution

by:
gheist earned 100 total points
ID: 10868055
export TAPE=/dev/rmt0.1
tar c /
:-)
default is TAPE=/dev/rmt0.0

for full bakup:
1) make mksysb bootable tape
2) make volume group file backups (smit, snoop commands using Esc-6)
3) make backups from applications using raw aio volumes (db2, informix, oracle etc)
4) label tape(s) and write restore guide :-)

mt is your good friend for rewinding/forwarding tape ( read man mt )
you need eof mark on tape to start new backup.
0
 
LVL 20

Expert Comment

by:Gns
ID: 10868190
... AFAIK, #1 run from smitty is exactly the same as running "mksysb -i" :-).
Both mksysb and backup/restore have excellent well, at least OK) man-pages.
... And don't forget to take any database you have offline before dumping... Else you need a) really expensive backup system with really expensive "connector module" (like Legato Networker / BSM for Oracle:-), or b) some knowledge on how to make a script/sql-script to take "selected parts" ... "soft offline" ,,, and just dump the (at the moment) invariant db file/raw device (or do battle with rman). Going for a completely offline setup is very much simpler (especially when restoring) than any online setup.

-- Glenn
0
 
LVL 20

Expert Comment

by:Gns
ID: 10868197
BTW gheist, I thought tctl was the command and mt the conveniance ;-)

-- Glenn
0
 
LVL 62

Expert Comment

by:gheist
ID: 10869333
mt is posix , tctl and dasd is mainframe
0
 
LVL 20

Expert Comment

by:Gns
ID: 10869486
Convenience all around then :-)

-- Glenn
0
 
LVL 3

Expert Comment

by:esanchezvela
ID: 13112589
hi,

It looks a little too late to answer this anyway,..but here it goes anyway...

I belive the question is why other directories than the ones specified in the script landed in the tape the answer is because tar does not respect filesystem boundaries, if you want to backup just  / (root filesystem) I would recommend you use the backup command in the following way...

              find / -xdev -print | backup -ivf /dev/rmt0.1

that way only the rootfs will be sent to tape.

regards,
esv.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
reinstall 1 92
cron job says it ran, no results 25 128
check unix curl command return value 7 187
Field name with special character (Ñ) in Oracle 11 130
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question