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. :-)
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!