From: Mark Kilmartin (mrk at domain renre-europe.com)
Date: Mon 08 Oct 2001 - 14:32:13 IST
I was hoping to find a solution that would also allow for easy
untarring.
So split and the above option are sort of out.
If I can't find an option that provides easy untarring I will probably
go with something like the following.
tar -cz <what_ever_I_want_to_compress> | split -b <size of chunks> -
<prefix>
Of course in use I would probably wrap it in a small script so the name
of whatever I'm tarring is linked to the prefix.
MArk
On Mon, 2001-10-08 at 14:18, Wesley Darlington wrote:
> On Mon, Oct 08, 2001 at 01:33:58PM +0100, Mark Kilmartin wrote:
> > Is there any way to tell tar to output say <prefix>1.tar, <prefix>2.tar
> > ... prefix<n>.tar
> <snip>
> > But I would rather a solution which would allow me to supply the prefix
> > option and tar would then go and create as many 2G files as need to
> > complete the backup.
>
> This is just a thought, but if you call gnu tar like this...
>
> export TAPE=/tmp/thing.tar
> tar cv -M -L 512 -F ./rotate.pl what-to-backup ...
> ./rotate.pl # Extra one necessary to rotate final file
>
> ...where /tmp/thing.tar is the base name of where you want the output to go,
> 512 is the size (in kB) of each part file and ./rotate.pl is a script to do
> the rotating. Something like... [0]
>
> ------------------------------------------------------------------------
> #!/usr/bin/perl -w
> use strict;
>
> my $filename = $ENV{TAPE};
> my $i = 1;
> my $worked = 0;
>
> while (!$worked) {
> my $newfilename = sprintf ("%s.%04d", $filename, $i);
> ++$i && next if -e $newfilename;
> # <---- Race conditions `R' us
> rename ($filename => $newfilename) and $worked=1;
> };
> ------------------------------------------------------------------------
>
> Unrotating is a different problem. :-)
>
> Wesley.
>
> [0] Please, I just threw this together. :-)
>
> --
> Irish Linux Users' Group: ilug at domain linux.ie
> http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at domain linux.ie
This archive was generated by hypermail 2.1.6 : Thu 06 Feb 2003 - 13:12:37 GMT