Tar: error! blocksize changed

 
SOLVED
Go to solution
Renda Skandier
Frequent Advisor

Tar: error! blocksize changed

Hi,
Iâ m trying compress an entire directory into a single file using tar. For the sake of debugging, I am trying it using just 2 files.
The resulting files appear to be correct and work fine but I always get an error â Tar: error! blocksize changedâ . See below.
I have tried waiting an extended amount of time to be sure it it not a timing issue and my file size is well below 2G.

ANY IDEAS??

tar -cvf softran.TAR .
produces:
a ./eft110.cbl 61 blocks
a ./install.sh 1 blocks
a ./softran.TAR 60 blocks
./softran.TAR: file changed size

the result is:
-rw-rw-r-- 1 sysmnt sysmnt 133120 Mar 8 09:03 softran.TAR

when I extract using
tar -xvf softran.TAR

x ./eft110.cbl, 31033 bytes, 61 tape blocks
x ./install.sh, 36 bytes, 1 tape blocks
x ./softran.TAR, 30720 bytes, 60 tape blocks
Tar: error! blocksize changed

7 REPLIES 7
A. Clay Stephenson
Acclaimed Contributor
Solution

Re: Tar: error! blocksize changed

You are trying to create a tarfile in the same directory that you are taring; ie, the tar is trying ti tar itself.

Do this:
tar cvf /var/tmp/softran.TAR .

assuming that your CWD is not /var/tmp.
If it ain't broke, I can fix that.
Thierry Poels_1
Honored Contributor

Re: Tar: error! blocksize changed

hi,

you also are TARing the destination file into the tarfile, so the file it's trying to tar is being changed at the same time.

try:
tar cvf ../softran.TAR *
or
tar cvf softran.TAR !(softran.TAR)

good luck,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Patrick Wallek
Honored Contributor

Re: Tar: error! blocksize changed

Clay is absolutely correct.

If you absolutely MUST create the tar file in the same directory as the rest of your files, I would do something like this:

# ls -1 > /var/tmp/file

# tar -cvf softran.TAR $(cat /var/tmp/file)

This will create your tar file in the same directory but will not try to include itself in the tar file.
Thierry Poels_1
Honored Contributor

Re: Tar: error! blocksize changed

hmmmz, it seems it was mixing things up
the second one should have been:

tar cvf softran.TAR $(!softran.TAR)
(tar all files except softran.TAR)

sorry & good luck,
Thierry
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Thierry Poels_1
Honored Contributor

Re: Tar: error! blocksize changed

aaaaaarggghh
I was mixing up my mixed up stuff :-(

tar cvf softran.TAR !(softran.TAR)
was indeed the correct one, sorry sorry sorry

Thierry (need more sleep ;)
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Sanjiv Sharma_1
Honored Contributor

Re: Tar: error! blocksize changed

Hi,

Please check this link
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=190047
Everything is possible
Renda Skandier
Frequent Advisor

Re: Tar: error! blocksize changed

Thanks everyone! I knew it was something I was just missing.

It took me awhile because I missed the "."
at the end of
tar cvf /home/live/updates/$1/softran.TAR .

for future readers I also needed to change the extract line to extract from a diff dir
tar -xvf /home/store/files/softran.TAR

THANKS AGAIN!