Penguin
Note: You are viewing an old revision of this page. View the current version.

Multiple Tar Files

Sometimes it is necessary to split a tar archive over several volumes, or files.

If you specify several archive files, tar will use them in the order given. Try something like this
tar -c -L 50000 -f archive1 -f archive2 -f archive3 ... path

Be sure to specify enough archive files to hold the entire data.

You won't find this use of multiple -f options mentioned in the man page, but it is in the info page. (You have to hunt around to find it, though--the GNU tar info page is poorly organized.)

Here is my crackin bash script to backup stuff into 1gig volumes
  1. /bin/bash

cd /test/archive/ each_archivesize=1000000 totalkbytes=`du -s . | cut -d "." -f 1` num_volumes=`expr $totalkbytes / $each_archivesize + 1` tar_args=`for i in $(seq 1 $num_volumes) ; do echo -n "-f archive$i.tar "; done`

tar -cvL $each_archivesize $tar_args --totals *