How to change blocksize for in tar command


 
Thread Tools Search this Thread
# 1  
Old 10-11-2006
How to change blocksize for in tar command

How can I change the blocksize in tar command?

tar cvf test.tar backup.sh
a backup.sh 1K

If we need to set the blocksize to 20, how to do that?

Please advise.
Thank you.
# 2  
Old 10-11-2006
man tar

to create archive

tar cvfb <filenm.tar> 20 <files to archive >

to check block size

tar tvf <filenm.tar>
OR
tar tvf <filenm.tar> 30

anybode please correct me if wrong

samsam
# 3  
Old 10-11-2006
Hi,
Thanks for your quick response.
I managed to do the tar now. By the way, the blocksize show 4,

# tar cvfb test.tar 20 backup.sh
a backup.sh 1K

# tar tvf test.tar
tar: blocksize = 4
-rwxr-xr-x 0/1 76 Jul 20 16:21 2005 backup.sh
# tar tvf test.tar 30
tar: blocksize = 4

Please advise.
Thank you.
# 4  
Old 10-11-2006
The blocksize shows 4, but we need set it to 20.
How can we do that?
# 5  
Old 10-11-2006
It might depend on which tar you're using.

Linux/tar:
Code:
tar -c -b 20 -f test.tar -v backup.sh

OpenBSD/tar:
Code:
tar -c -b 20 -f test.tar -v backup.sh

By the way, the default (per the two man pages) is 20 blocks. POSIX max is 63 and max under OpenBSD is 126. The man page on linux doesn't show the maximums. I brought up info tar but it's pages and pages of stuff. Feel free to run that if you have a few minutes to spare Smilie

Carl
# 6  
Old 10-11-2006
Bug

In Tru64,
> tar cvfb test.tar 20 abc
a abc 0 Blocks
> tar tvf test.tar
blocksize = 20
-rw-r--r-- 0/15 0 Oct 12 11:19:14 2006 abc

In Solaris,

# ls -al abc
-rw-r--r-- 1 root other 0 Oct 12 11:20 abc
# tar cvfb test.tar 20 abc
a abc 0K
# tar tvf test.tar
tar: blocksize = 3
-rw-r--r-- 0/1 0 Oct 12 11:20 2006 abc

How can we get the blocksize in solaris to set as tru64 blockszie?
# 7  
Old 10-12-2006
My sun box (solaris 8) I have here says (via man) that 20 is the default. I ran the same command you did but the test option doesn't show the blocking factor. I tried it with a blocking factor of 30 but it still didn't show it.

Carl
 

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Tar Command only UNIX for Advanced & Expert Users 6 08-01-2018 11:10 PM
UNIX command to check if file name ends with .tar OR if the file is a tar file sanjaydubey2006 UNIX for Dummies Questions & Answers 10 02-19-2015 05:40 PM
Single command - unzip files from a tar command ericlim Shell Programming and Scripting 9 04-03-2012 02:48 PM
tar command to explore multiple layers of tar and tar.gz files bashnewbee Shell Programming and Scripting 1 07-12-2011 05:08 PM
tar command u.n.i.x Linux 2 01-22-2010 01:09 AM
Tar Command killos UNIX for Dummies Questions & Answers 2 11-11-2009 09:30 AM
tar command dont tar to original directory borderblaster Shell Programming and Scripting 1 10-16-2009 05:55 AM
tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file ahSher UNIX for Dummies Questions & Answers 2 04-02-2009 04:43 AM
Tar blockSize problem scriptingmani Solaris 2 09-26-2007 04:10 AM
tar: blocksize = 0 - Error message? Tlogine UNIX for Dummies Questions & Answers 3 08-11-2007 06:32 PM
tar: blocksize melanie_pfefer UNIX for Dummies Questions & Answers 0 07-17-2007 07:43 AM
tar: tape blocksize error big123456 UNIX for Advanced & Expert Users 1 03-26-2007 06:57 AM
Blocksize problem restoring file from tape citrowske UNIX for Dummies Questions & Answers 11 10-17-2005 04:22 PM
Tar: tape blocksize error ramkumar UNIX for Advanced & Expert Users 1 08-09-2005 12:09 PM