I've written a small shell script splitting large TAR archives into smaller ones. Each of the smaller files is a proper TAR archive.
Download the actual version (1.11 of 2006/06/02) of the script.
All my tools are distributed in the hope that they will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
The programs are free software; you can redistribute them and/or modify them under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version.
You should have received a copy of the GNU General Public License along with those programs; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you find this software useful, please send me a postcard from the place
where you are living:
Dr. Jürgen Vollmer
Am Rennbuckel 21
D-76185 Karlsruhe, Germany
usage: split-tar [options] tarfile.<suffix> (filename|directory)... Splits a large tar archive into a set of smaller ones. Creates a set of tar archives direct from the files and directories. <suffix> is one of tar, tar.gz, tgz, or tar.bz2 Files are written to tarfile-???.<suffix> into the current working directory, where ??? are three digits. Note: since a TAR file contains tar-specific administration information the resulting tar files may be larger that the specified size. For computation only the file size of the sources are used. Note: split-tar relies on the GNU version of "tar", "find" and "bash". Note: split-tar is not able to read the filenames from stdin. Use -T instead. Options: -c : Create the tar archives from [filename|directory...]. -C opts : Pass opts to tar, when creating the tarfile with -c the compression options -z (gzip) or -j (bizp2) are added by default, if the <suffix> indicates it. -e rate : To compute the set of files to be put into a compressed tarfile, one has to estimate compressed size of each uncompressed source file. To do this a compression program indicated by the tarfile.<suffix> is called (e.g. gzip). This may be quite time consiming. This overhead my be avoided by giving an "compression rate" using the -e option. The real file-size of an an uncompressed file is divided by that <rate>. This may result in too large or too small result tarfiles. So one has to to some trial and error to get the <rate> value right. The <rate> is positive number. -f prog : Use prog as "find" program, e.g. -f /usr/local/bin/gfind -N date : Only store files newer than <date>. Typical format: YYYY-MM-DD or 'YYYY-MM-DD HH:MM:SS' or if <date> begins with `/' or `.', it is taken to be the name of a file whose last-modified time specifies the date. -N passes its argument as tar option `--newer=<date>' (this may be changed in the source of this script, see variable TAR_NEWER). -N is valid only if -c is given. -h : Help -s sizeK : Maximum size of one tar file in Kilo bytes, default 1024 -s sizeM : Size given in Mega Byte -s sizeG : Size given in Giga Byte -S : Split the existing tar archive tarfile.<suffix> no [filename|directory...] may be given that's the default -t prog : Use prog as "tar" program, e.g. -t /usr/local/bin/gtar -T file : Read names to create the archive from <file> -v : Verbose (verbose tar messages) -V : Version. Example: Splitting an already existing archive: If foo.tar.gz has a size of 3 M bytes, the command split-tar -s 1M foo.tar.gz will create the three tar.gz archives: foo-000.tar.gz foo-001.tar.gz foo-002.tar.gz which may be unpacked as usual: tar -xzvf foo-000.tar.gz tar -xzvf foo-001.tar.gz tar -xzvf foo-002.tar.gz and the the result would be the same as if one unpacks the initial archive tar -xzvf foo.tar.gz Creating the archives directly from the sources: split-tar -e 5 -s 10M -c foo.tar.gz /home/foo will create tar archives: foo-000.tar.gz, .... foo-<n>.tar.gz containing foo's home directory. A compression rate of 5 is assumed for all not already compressed files. Requirements: BASH, GNU-tar, and GNU-find. Version: 1.11 of 2006/06/02 Author: Dr. Jürgen Vollmer <firstname.lastname@example.org> If you find this software useful, I would be glad to receive a postcard from you, showing the place where you're living. Homepage: http://www.informatik-vollmer.de/software/split-tar.html Copyright: (C) 2003 Dr. Jürgen Vollmer, Viktoriastrasse 15, D-76133 Karlsruhe, Germany License: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Revision 1.30 2010/01/13 17:57:52 vollmer typoo Revision 1.29 2006/07/10 07:17:28 vollmer typoo Revision 1.28 2006/06/02 09:26:07 vollmer typoo Revision 1.27 2006/04/24 14:11:46 vollmer typoo Revision 1.26 2006/02/23 20:01:46 vollmer Now all directories get the correct time stamp. Sorting works as expected, even if non- 7-bit-ASCII letters are used by using LC_ALL=C. Thanks to one who wants to be unnamed for sending me the bug-fixes. Revision 1.25 2005/04/27 13:48:34 vollmer Add all intermediate directories of a path explicitly in order to get file/directory ownership correctly. Thanks to Tom Battisto <tbattist-AT-mailaka.net> for the bug report. Revision 1.24 2005/04/26 07:56:49 vollmer Directory persmissions are set now correctly when unpacking the archives. Thanks to Tom Battisto <tbattist-AT-mailaka.net> for the bug report. Revision 1.23 2005/04/08 20:52:32 vollmer Added option -T, thanks to Juergen Kainz <jkainz-AT-transflow.com> Revision 1.21 2005/04/08 20:14:22 vollmer added option -e Revision 1.20 2004/07/23 21:30:15 vollmer - added -f and -t options to specify a FIND and TAR program. Revision 1.18 2003/11/06 16:24:13 vollmer - options passed by -C to tar will be passed now to the do_tar routine - \ as part of file names are allowed now Thanks to A. R. Revision 1.17 2003/11/03 16:42:10 vollmer - Added option -N - The created tar files are stored now in the given directory and not in the current one. Thanks to Martin Walter <martin.walter-AT-erol.at>, who found that bug and asked for -N Revision 1.16 2003/10/31 13:01:51 vollmer Creating a splitted tar file from directory works now for absolute path names of the directory Revision 1.15 2003/09/18 17:10:40 vollmer Filenames containing blanks are processed correctly if given on the command line. Thanks to Dr. Jim McCaa <jmccaa-AT-ucar.edu>, who gave me the fix. Revision 1.14 2003/08/18 07:28:16 vollmer The number followed -s must be followed now by k m or g (in order to make `expr' more portable) Revision 1.13 2003/08/12 07:56:38 vollmer added an Example Revision 1.12 2003/08/12 07:22:27 vollmer fixed a bug found by Willem Penninckx <willem.penninckx-AT-belgacom.net>: filenames may contain now blanks and * and other shell emta charcters. Revision 1.11 2003/07/29 14:08:10 vollmer added the aibility to create the tar archive directly from the sources (option -c) Revision 1.10 2003/07/29 13:01:50 vollmer -s accepts size specifier k,K,m,M,g or G Revision 1.9 2003/07/29 12:38:17 vollmer improved computing expected size computation Revision 1.8 2003/07/21 07:55:32 vollmer added --no-name option to the gzip COMPRESS_CMD Revision 1.7 2003/07/15 08:27:04 vollmer - added bzip2, thanks to Martin Deinhofer <martin.deinhofer-AT-gesig.at> - added length of file names when computing the size Revision 1.0 2003/07/02 14:57:17 vollmer Initial revision #############################################################################© Copyright 2005 Dr. Jürgen Vollmer (www.informatik-vollmer.de)