General
cancel
Showing results for 
Search instead for 
Did you mean: 

make tar archives muti volume...?

SOLVED
Go to solution
jackfiled
Advisor

make tar archives muti volume...?

Hi all
I want to make tar archive file.
Created tar file limited specified size

for example
In sub dir size is 3072MB, tar created files are 1535MB each

How can execute that command?
10 REPLIES
Huc_1
Honored Contributor

Re: make tar archives muti volume...?


In the gnu tar man page there is an -M qualifier this creates a multi volum tape !

I have never tryed such a long tar file myself but always have belief this did the trick ?

Have you tryed this ?

J-P
Smile I will feel the difference
Michael Schulte zur Sur
Honored Contributor

Re: make tar archives muti volume...?

Hi,

just curious. Is it because of limitted space on disk, that you want to split it? If not make the tar file one file and then split it using split or so.

greetings,

Michael
Solution

Re: make tar archives muti volume...?

Hi,maybe You can give split-tar a try. It can create standalone tar's at the given size.You can find it under http://www.informatik-vollmer.de/software/split-tarThomasPS: I'm not related to Jürgen Vollmer in any kind ;
jackfiled
Advisor

Re: make tar archives muti volume...?

-M options
How it applied..?
I can not find example.
Thierry Poels_1
Honored Contributor

Re: make tar archives muti volume...?

hi,

more complex, but does work:


mknod /tmp/mypipe p
split -b1M - /dir/mytar < /tmp/mypipe &
tar cvf /tmp/mypipe /dir/files
rm /tmp/mypipe

to restore:
cat /dir/mytar* | tar xvf -

adjust the size parameter in the split commands to your needs (set at 1MB in this example).

regards,
Thierry.
All unix flavours are exactly the same . . . . . . . . . . for end users anyway.
Mark Grant
Honored Contributor

Re: make tar archives muti volume...?

Jackfiled,

Huc is talking about GNU tar. This tar doesn't come with HPUX. You will need to install it first. You can then use the "-M" option.

You can get GNU tar here.

http://hpux.connect.org.uk/hppd/hpux/Gnu/tar-1.13.25/
Never preceed any demonstration with anything more predictive than "watch this"
Huc_1
Honored Contributor

Re: make tar archives muti volume...?

Ah did not understand this to be a HP-UX question ... as this is linux forum... but Yes do as mark suggest if this posible for you !

Thank, mark

J-P
Smile I will feel the difference
Mark Grant
Honored Contributor

Re: make tar archives muti volume...?

Actually Huc, I think I got it wrong :)

This is in the linux forum but my head was in the HP-UX forum!
Never preceed any demonstration with anything more predictive than "watch this"
jackfiled
Advisor

Re: make tar archives muti volume...?

thank you for your reply my problem..
I really appreciate that. ^^
Stuart Browne
Honored Contributor

Re: make tar archives muti volume...?

the '-M' in GNU tar is mainly for going to media.

i.e. tar cvMf /dev/fd0 list/of/files

This will automatically split across the diffent media volumes as required, prompting you to insert the next one.

If wanting to use a fixed sized file, then you have to couple it with the '-L' flag, to say how big you want them to get.

i.e. tar cvMLf 3072 /path/to/out.tar path/to/files

However, as you aren't changing 'media' between volume changes, you will probably have to create a script to pass to the '-F' flag to move the individual files into something different.

i.e. tar cvMLFf 3072 /tmp/move.script /tmp/out.tar path/to/files

--- /tmp/move.script ---
#!/bin/bash
VAL=1
until [ ! -f /tmp/out.tar.${VAL} ]
do
VAL=$((VAL + 1))
done
mv /tmp/out.tar /tmp/out.tar.${VAL}
--- /tmp/move.script ---

This will leave you to move the last file to the appropriate number of course.

Anyway.. Some fun for you..

Hope this helps.
One long-haired git at your service...