[nflug] tar to multiple

Ken Smith kensmith at cse.Buffalo.EDU
Fri Feb 9 08:35:41 EST 2007


On Fri, 2007-02-09 at 08:00 -0500, Cyber Source wrote:
> Ok,
>   I've read till my eyes are bleeding and I've googled to no avail. I'm
> also quite convinced that whoever the guy was that wrote the info file
> for tar, must speak like an android. I've tried the various examples
> that I have found but none work.
>  Can someone please enlighten me on how one would use tar to create
> multiple files split at a certain size? Say 1MB?
> Here is one example I tried that did not work...
> 
> 
>   peter at Office:~/tartest$ tar -cv -M -L 1024 -f songs.tar
> /home/peter/Music tar: Removing leading `/' from member names
> /home/peter/Music/
> /home/peter/Music/07-the_mars_volta-cicatriz_esp-chr.mp3
> Prepare volume #2 for `songs.tar' and hit return:
> Prepare volume #3 for `songs.tar' and hit return:
> Prepare volume #4 for `songs.tar' and hit return:
> Prepare volume #5 for `songs.tar' and hit return:
> Prepare volume #6 for `songs.tar' and hit return:
> 
> and it will just go on and on and on. The result is this;
> peter at Office:~/tartest$ ls -lh
> total 1.1M
> -rw-r--r-- 1 peter peter 1.1M 2007-02-09 07:56 songs.tar
> So, it's starting it but I must be missing a naming convention here. Any
> help please from the command line/tar wizards?
> TIA, Peter

Actually I think you mean " ... So, it's *ending* it but ...".

tar(1) is really cool for manipulating stuff as files but every once in
a while you need to keep in mind it was originally designed to write
stuff to tape (tar == Tape ARchiver).  The "songs.tar" file is likely
the *last* chunk of data that got written, not the first.  The
expectation is you want all the pieces to go to the same filename (the
device name of your tape drive) and in between volumes (where it's
saying Prepare volume ...") you're switching tapes.

Option #1 is for you to manually copy "songs.tar" to a different
filename while it's waiting between volumes (simulating the switching of
the tapes).  Option #2 is just let it write one big songs.tar file and
use a different utility to split them up (e.g. split(1)).  If you want
to you can instead of using songs.tar as an intermediate step have tar
write to stdout and pipe it through to split directly.

-- 
                                                Ken Smith
- From there to here, from here to      |       kensmith at cse.buffalo.edu
  there, funny things are everywhere.   |
                      - Theodore Geisel |


_______________________________________________
nflug mailing list
nflug at nflug.org
http://www.nflug.org/mailman/listinfo/nflug



More information about the nflug mailing list