Rev | Author | # | Line |
---|---|---|---|
3 | AristotlePagaltzis | 1 | !!! Multivolume [TarBall]s |
1 | DanielLawson | 2 | |
3 | AristotlePagaltzis | 3 | Sometimes it is necessary to split a TarBall into several files, ie volumes. The simplest approach is to use split(1): |
1 | DanielLawson | 4 | |
3 | AristotlePagaltzis | 5 | tar cvzf - dirs/ | split --bytes 1m - archive.tar.gz.part- |
1 | DanielLawson | 6 | |
3 | AristotlePagaltzis | 7 | Should you need to, you can achieve this goal without split(1) using tar(1)'s __-L__ switch, which sets a volume size limit. While the poorly organized info page for tar(1) mentions this, the man page contains no hint that you must also specify a list of filenames for tar(1) to use by passing more than one __-f__ switch: |
1 | DanielLawson | 8 | |
3 | AristotlePagaltzis | 9 | tar c -L 50000 -f archive1 -f archive2 -f archive3 [[ ... ] path/ |
1 | DanielLawson | 10 | |
3 | AristotlePagaltzis | 11 | Make sure to specify enough archive files to hold the entire data. If you don't want to be bothered with math the computer can do for you, this script should help: |
1 | DanielLawson | 12 | |
13 | #!/bin/bash | ||
3 | AristotlePagaltzis | 14 | VOL_SIZE_KB=1000000 |
15 | BASENAME=archive | ||
1 | DanielLawson | 16 | |
3 | AristotlePagaltzis | 17 | TOTAL=$( du -s . | cut -d $'\t' -f 1 ) |
18 | NUM_VOLUMES=$(( $TOTAL / $VOL_SIZE_KB + 1 )) | ||
2 | MichaelBordignon | 19 | |
3 | AristotlePagaltzis | 20 | tar cv -L $VOL_SIZE $( seq -f "-f $BASENAME-%03g.tar" 1 $NUM_VOLUMES_KB ) --totals * |
2 | MichaelBordignon | 21 | |
3 | AristotlePagaltzis | 22 | The example will create 1GB [TarBall]s of the current directory named __archive-*__. |
lib/blame.php:177: Warning: Invalid argument supplied for foreach()