Operating System - HP-UX
1833792 Members
2651 Online
110063 Solutions
New Discussion

Tar files bigger than original directory.

 
faze
New Member

Tar files bigger than original directory.

Hi

It seem like the tar file bigger than the original directory sizes. My tar files size=2GB but my directory only 900mb in total. This does look right. doesn't it?
9 REPLIES 9
Muthukumar_5
Honored Contributor

Re: Tar files bigger than original directory.

What you are getting for this?

a) du -ks /directory

how did you use tar command execution?

--
Muthu
Easy to suggest when don't know about the problem!
faze
New Member

Re: Tar files bigger than original directory.

Hello,

I'm getting:

$ du -sk
951574 /app/ldap/5.2


Muthukumar_5
Honored Contributor

Re: Tar files bigger than original directory.

$ du -sk
951574 /app/ldap/5.2

>>>

~ 930 MB. Ok. Try this,

$ tar -cvf /tmp/trial.tar /app/ldap/5.2
$ du -ks /tmp/trial.tar

what are you getting now?

--
Muthu
Easy to suggest when don't know about the problem!
V. Nyga
Honored Contributor

Re: Tar files bigger than original directory.

Hi,

it seems like you wrote your tar file in the same directory, that you wanted to tar.
So the tar command added the comlete tar file to your tar file.
So you've a file with the double size.
Look for the same name inside the tar file.
You can check it with 'tar tvf '

HTH
Volkmar
*** Say 'Thanks' with Kudos ***
Antonio Cardoso_1
Trusted Contributor

Re: Tar files bigger than original directory.

Hi,

what options do you use in your tar command?
If using -h option (follow links) and the source directory contains links, this could explain differences.

find -type f

to look for links

antonio.
Peter Godron
Honored Contributor

Re: Tar files bigger than original directory.

faze,
I would agree with Antonio's analysis.

The tar command would not back up its own tar output file.
A list of files to be backed up is obtained before the tar starts.

I have done a very quick check with tar and the logical links would be backed up.
Radhakrishnan Venkatara
Trusted Contributor

Re: Tar files bigger than original directory.

No it will add the tar file also into the archive. Tar used in SUN will be handled wisely it won't add it. But HP adds it.It is tested.
Negative thinking is a highest form of Intelligence
V. Nyga
Honored Contributor

Re: Tar files bigger than original directory.

Thanks Radhakrishnan :-)

I've enough experience with my own users and also external users sending me such tar files.
Of course it can also be a backup of links.
The best would be faze tells us which command in which directory he used.

Peace
V.
*** Say 'Thanks' with Kudos ***
Peter Godron
Honored Contributor

Re: Tar files bigger than original directory.

log of my tar test:
# cd test
# ll
total 0
# touch file1
# touch file2
# ll
total 0
-rw-rw-rw- 1 root sys 0 Mar 28 10:33 file1
-rw-rw-rw- 1 root sys 0 Mar 28 10:33 file2
# tar -cvf x.tar *
a file1 0 blocks
a file2 0 blocks
# tar -tvf x.tar
rw-rw-rw- 0/3 0 Mar 28 10:33 2006 file1
rw-rw-rw- 0/3 0 Mar 28 10:33 2006 file2
# ll
total 32
-rw-rw-rw- 1 root sys 0 Mar 28 10:33 file1
-rw-rw-rw- 1 root sys 0 Mar 28 10:33 file2
-rw-rw-rw- 1 root sys 10240 Mar 28 10:33 x.tar

Seems x.tar was not backed up into x.tar