1833827 Members
2346 Online
110063 Solutions
New Discussion

Using tar command

 
SOLVED
Go to solution
Jennifer Lam
Advisor

Using tar command

Hi all,
I have a question regarding about create a tar file using a tar command. I am using HP-UX 10.20. When I execute the tar command by manual,it is worked:
tar cvf BK.tar cantata marcato rhapsody
but when I put in the script, it does not work and send the error message is:
./ASIBk[29]: /usr/bin/tar: arg list too long
-ASIBk is the script name
-29 is the line number
-cantata, marcato, and rhapsody are the directories that I would like to tar.
Would you help me with this problem. Thank you.
Regards,
Jennifer Lam.

9 REPLIES 9
A. Clay Stephenson
Acclaimed Contributor

Re: Using tar command

Your syntax looks perfect. I can only guess that perhaps there is a '*' past your 3 directories OR the command is continued onto the following line OR something like a missing quote. I think your actual problem is somewhere else in the script. A good test would be to put a '#' at the beginning of the line that contains the tar and see if the script executes as expected. This error is telling you that tar is seeing a very long argument list.
If it ain't broke, I can fix that.
Steven Sim Kok Leong
Honored Contributor

Re: Using tar command

Hi,

Can you show us your script?

You could get the "argument list too long" error if you had used wildcards in your script i.e.:

tar cvf BK.tar cantata/* marcato/* rhapsody/*

This is because the wildcars are expanded by the shell interpreter before passing on to the tar command.

To fix that, use the same syntax you did on the command line, that is:

tar cvf BK.tar cantata marcato rhapsody

Hope this helps. Regards.

Steven Sim Kok Leong
Michael Tully
Honored Contributor

Re: Using tar command

Hi,

There are couple of things you could do. You could try and include './' in front of the directories names in your script. The real answer is to change the 'large_ncargs_enabled' parameter in your kernel to the value of '1'
The default is 20478 bytes, (value 0) but you can increase this value to 2048000 by changing the kernel parameter.
You can use the command 'getconf ARG_MAX'

$ getconf ARG_MAX
20478

HTH
~Michael~
Anyone for a Mutiny ?
MANOJ SRIVASTAVA
Honored Contributor

Re: Using tar command

Jennifer

the problem is * is intrepeted as say x no . of lines , now trar can have only a fix argument which by default is 20478 , even any other operation using this * like rm -i will not be possible as it will again complin about it , solution is to either increse the arg count or may be try to split the list like

tar cvf abc,tar < directory 1 >
tar uvf abc.tar
tar uvf abc.tar


Manoj Srivastava
Niraj Kumar Verma
Trusted Contributor

Re: Using tar command

hi

tar uvf abc.tar
tar uvf abc.tar


-niraj
Niraj.Verma@philips.com
Jennifer Lam
Advisor

Re: Using tar command

Hi Michael,
I am running HP-UX 10.20.
I would like to know how or what file do you get in to change the 'large_ncargs_enable' parameter in kernel to 1?
I did try the following:
- I type in the command
$ getconf ARG_MAX (I get 20478)
20478
- I did try to get in SAM to configuration, but I don't see the parameter
'large_ncargs_enable'
Would you help me. Thank you.
Regards,
Jennifer Lam.
Michael Tully
Honored Contributor
Solution

Re: Using tar command

Hi Jennifer,

To be able to see this parameter you need to first install patch PHKL_16410. See the details below. Once you have installed the patch you should be able to see the parameter within SAM.

HTH
Michael


Here is the details from the Technical Knowledge Base document:

PROBLEM
I am getting errors like:

Arg list too long

when I issue certain commands, such as 'find'. What is causing the
error and how can I make it go away?

CONFIGURATION
Operating System - HP-UX
Version - 10.20

RESOLUTION
The 'arg list too long' error occurs when you exceed the maximum
length of arguments that can be passed to a command.

The default is 20478 bytes, but you can increase this value to 2048000
by setting the kernel parameter 'large_ncargs_enabled = 1' (default is 0).

You can execute 'getconf ARG_MAX' to find out if 'large_ncargs_enabled'
is set to 1 or 0. For example:

$ getconf ARG_MAX
20478

If you receive 20478 when you execute the command, recompile the kernel
with 'large_ncargs_enabled = 1' to resolve the error.

Note that for HP-UX 11.0 systems, the limit is set to the larger value
by default, and the large_ncargs_enabled kernel tunable is not needed.

Note that patch:

PHKL_16410
s800 10.20 LVM/UFS/NDDB/flkmgr/VxFS,DMAPI/PCI/SCSI/MO/dump

enables this kernel parameter, so you may need to install it if you
do not already have it or a superseding patch installed already.

Note: This patch, as with any patch, may be superseded. Please
check for the latest patch at the Electronic Support Center
(ESC) by using either of these web sites:

http://us-support.external.hp.com

http://europe-support.external.hp.com

Anyone for a Mutiny ?
James R. Ferguson
Acclaimed Contributor

Re: Using tar command

Hi Jennifer:

First, you will need to have patch PHKL_16751 installed.

Then will need to add a line to 'stand/system' in the tunable parameters list that reads:

large_ncargs_enabled 1

Next, you can use SAM and regenerate your kernel. Upon reboot, you should have the larger environement space.

Regards!

...JRF...


James R. Ferguson
Acclaimed Contributor

Re: Using tar command

Hi Jennifer:

Do *not* use PHKL_16410 as you will see from the Patch Database. You will note the critcal alert, "Patch PHKL_15959 introduced a problem...while the problem was introduced in PHKL_15959, it is also present in superseding patches PHKL_16388, PHKL_16410...".

Use the successor patch PHKL_16751.

Regards!

...JRF...