Solved

AIX - Archiving (tar) a filesystems and excluding a directory

Posted on 2013-05-13
4
725 Views
Last Modified: 2013-05-14
Please help with tar command. See below.

Trying to archive /business/obj/11.2 and trying to exclude /business/obj/11.2/data

Here is what I tried:

tar -cvf /business/obj/11.2.tar -X /business/obj/11.2/data /business/obj/11.2

and here is my ouput, which is not working:

a /business/obj/11.2 (excluded)
0
Comment
Question by:AIX25
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 500 total points
ID: 39162331
Hi,

if it's AIX tar then -X expects a file containing names of directories to be excluded, and not a direct value.

So create a file, let's say "/tmp/tar_excl" containing just the string

/business/obj/11.2/data

an rerun your command like this:

tar -cv -X /tmp/tar_excl  -f /business/obj/11.2.tar  /business/obj/11.2
or
tar -cvf /business/obj/11.2.tar -X /tmp/tar_excl  /business/obj/11.2

I assume you're aware that the name of your archive will be "11.2.tar" and that it will be located under the directory structure "/business/obj/"
0
 

Author Comment

by:AIX25
ID: 39162613
You method worked only to a point....it skipped /data, but it did not finish tar'ing up the directory.

I received this error:

tar: 0511-194 Reached end-of-file before expected.

Please advise
0
 

Author Comment

by:AIX25
ID: 39162623
Also, my ulimits are set to unlimited.
0
 
LVL 68

Assisted Solution

by:woolmilkporc
woolmilkporc earned 500 total points
ID: 39162676
Those errors are almost always related to space limitations, be it by ulimit, quota or filesystem size, or (sometimes) they're related to filesystem defects.

To rule this out nevertheless (to check if it's a read or logic issue) you could redirect the output to /dev/null :

tar -cvf  -  -X /tmp/tar_excl  /business/obj/11.2 >/dev/null

Note the "-" (minus) sign following "-f "!

You will see the verbose log anyway, because it goes to stderr.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone 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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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…

726 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