Untar to a particular directory is Failing


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Untar to a particular directory is Failing
# 15  
Old 07-18-2017
No, I mean it looks like you mounted the (a) swap file system on /tmp? If so, I'd be afraid this negatively influences all processes on the system.

Quote:
Originally Posted by mohtashims
.
.
.
Code:
bash-3.2$ df -k /tmp
Filesystem            kbytes    used   avail capacity  Mounted on
swap                 15585680 1294448 14291232     9%    /tmp

.
.
.
This User Gave Thanks to RudiC For This Post:
# 16  
Old 07-19-2017
What would happen if you did this:-
Code:
cd /target/directory
tar -xvf /path/to/tarball


I think that mounting /tmp using swap space is the default way that Solaris works, so I don't think there is an issue there unless you either boot (because, as swap, it doesn't persist) or you fill it and you server cannot swap.



Robin
# 17  
Old 07-19-2017
Yes, "swap" stands for "memory". For illustration
Code:
$ mount -v | awk '$3=="/tmp"'
swap on /tmp type tmpfs read/write/setuid/devices/xattr/size=4096m/dev=5740002 on Tue Apr 11 14:48:23 2017

The -C seems to work, as said in the man page (see post#1), only with "c" and "r" but not with "x".
But you can work around
Code:
tar -xvf bent.tar -C /web/applications/configurations

with a sub-shell
Code:
cat bent.tar | (chdir /web/applications/configurations && tar -xvf -)

The file - is stdin.
Or the other way round, give the path to the archive file
Code:
(cd /web/applications/configurations && tar -xvf /path/to/bent.tar)

where the only purpose of the subshell is to preserve the current directory in the main shell.
# 18  
Old 07-19-2017
Do you know the history of this .tar file?

Was it created on this system? If so, using what command?

If 'gtar' is installed on your system I would definitely just try substituting 'gtar' instead of 'tar' on the command line(s) and see what happens.

Many times I've had 'gtar' read a tarball that 'tar' couldn't read (properly).

Just a thought.
# 19  
Old 07-24-2017
Actually the problem is in the -C option of tar.
Code:
     -C directory file       Performs a chdir (see cd(1))  opera-
                             tion on directory and performs the c
                             (create) or r (replace) operation on
                             file.  ...

You are using eXtract which is not supported by the -C option. As far as I can see there is no equivalent option for extracting to a particular directory.

Andrew
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to Untar tar.gz to particular directory

Hi Guys, I am able to untar a tar.gz file. But it is again extracting the tar file to further child directory. I even tried the below command to untar it to particular directory. tar -zxvf gme_dly_sls_20120515035335.txt.tar.gz -C /sites/VSTAR/site/live/ftp/GMEUROPE I am getting the below... (4 Replies)
Discussion started by: mac4rfree
4 Replies

2. Solaris

Unable to Untar

Hello, bash-2.05# tar -xvf sunos.tar tar: directory checksum error bash-2.05# file sunos.tar sunos.tar: data bash-2.05# Can someone please help me untar this. This is a Solaris 9 box. (5 Replies)
Discussion started by: zigi_p5
5 Replies

3. Solaris

zip -r <directory> failing due to 2GB limit - Just asking opinion

Hi, Am trying to run zip -r on a 2.4G directory and it is failing with the error below. I believe this is because of the 2G limit of the zip program. server101(oper01)/u01/temp$: date Thu Mar 15 12:53:44 NZDT 2012 server101(oper01)/u01/temp$: ls -l total 8 drwxr-x--x 4 oracle dba ... (1 Reply)
Discussion started by: newbie_01
1 Replies

4. Shell Programming and Scripting

Untar specific directory and strip leading directories

Ok so I know the title was probably confusing so here goes: I have a tarball (gzipped) that has a nested directory structure . For example: my.tar.gz (contents) --- ------ --------- ------------ --------------- ... (2 Replies)
Discussion started by: DC Slick
2 Replies

5. Shell Programming and Scripting

cp, chown, untar

hello i want shell script. i have a source.txt /home/user409/public_html/test/ /home/user09876/public_html/xdsss/ /home/user9765/public_html/320xxx/ . . . maybe 1000 lines i want . 1.read a source.txt 2.untar special.tar.gz into these directory in source.txt 3.i want to... (14 Replies)
Discussion started by: topic32428285
14 Replies

6. AIX

untar

Hi, How can i untar a set of files in to different directory. This is content tar -tvf samba.tar drwxrwxrwx 0 0 0 Nov 28 18:35:41 2008 samba/ -rw-r--r-- 0 0 0 Nov 18 15:12:40 2008 samba/b.txt -rw-r--r-- 0 0 0 Nov 18 15:12:40 2008 samba/c.txt -rw-r--r-- 0... (4 Replies)
Discussion started by: allwin
4 Replies

7. Programming

Not able to use NFS mounted directory as buffer for untar & unzip.

Hi, For a new requirement, we are trying to use NFS mounted directory as the buffer (TMP_DIR) for untar. Target OS- VxWorks Host OS - Windows Embedded. mounted a directory in wondows onto VxWorks. During untar process of GNU we come across utime, for chaning the time stamp of the... (0 Replies)
Discussion started by: suraj.bc
0 Replies

8. UNIX for Dummies Questions & Answers

Untar problems

Hi, I am new to unix scripting. I have written a java program which will initialize a sftp connection and copy a unix script from my machine to a remote server. Then i initalized an ssh connection and i executed the script. This script contains a sequnece of commands and one of them is to... (2 Replies)
Discussion started by: vinothg
2 Replies

9. UNIX for Advanced & Expert Users

untar

i have try to untar the file in same location. But it gave the error # tar -xvf TSMSRVAIX5220.tar x tivoli.tsm.devices.acsls, 757760 bytes, 1480 media blocks. tar: 0511-169 A directory checksum error on media; 4011 not equal to 8222. How can i rectify this prob. Thanks in advance ... (2 Replies)
Discussion started by: prakash96453
2 Replies

10. UNIX for Dummies Questions & Answers

How can you UnTar files to a different directory?

Suppose you have a TAR file created with a different directory structure and you need to UnTar (or explode) the files to a different directory structure. How can this be done? If TAR command cannot do this, are there any other alternatives (any other command) available to UnTar a .Tar file? ... (1 Reply)
Discussion started by: joshivaibhav
1 Replies
Login or Register to Ask a Question