[nflug] tar to multiple

joshj at linuxmail.org joshj at linuxmail.org
Sat Feb 10 08:56:38 EST 2007


Thus spake Cyber Source:

> Ken Smith wrote:
>> 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.
>>
>>
> I know that it was originally made for tapes, etc., and that it thinks
> to change the tape at that point, but I'm pretty sure you can have it
> create different volume names, hence to write songs.tar1 songs.tar2,
> etc., automatically, this is where I'm stumped. The manual change would
> not be an option. I have to create files less than 1GB because of
> filesystem limits (udf) and was just using the 1MB as a test size.
> Option 2 would not be as good as dump and restore, of which I've
> resorted to, at least with that I could parse through the backups easily
> with restore. I was mainly curious about the tar option and also because
> it may take less space in the end.

It sounds like you're almost there. Except instead of changing tapes you
need to move that file to songs.1.tar or whatever so that it doesn't get
overwritten.

-Josh

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



More information about the nflug mailing list