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 linux.ie>http://www.linux.ie/mailman/listinfo/ilug for (un)subscription information.
> List maintainer: listmaster at linux.ie
Maintained by the ILUG website team. The aim of Linux.ie is to
support and help commercial and private users of Linux in Ireland. You can
display ILUG news in your own webpages, read backend
information to find out how. Networking services kindly provided by HEAnet, server kindly donated by
Dell. Linux is a trademark of Linus Torvalds,
used with permission. No penguins were harmed in the production or maintenance
of this highly praised website. Looking for the
Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!