Link to home
Create AccountLog in
Avatar of ppeiris
ppeiris

asked on

tar multi volume

I have to write a script to tar and transfer about 20GB amount of data... I was planing to use the multi volume option in tar to create series of 1GB files and transfer individually. I can run the following command but it wait for user input to create the next (disk2.tar) file. How can I automate this to just create all the disk(n).tar files without user interaction.
tar -cM --tape-length=1024000 --file=disk1.tar backup.tar

Open in new window

Avatar of Julian Parker
Julian Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

you havnt told it what to tar....

   tar -cM --tape-length=1024000 --file=disk1.tar backup.tar /backupdirectory
 
Avatar of ppeiris
ppeiris

ASKER

sorry ... in my case backup.tar is 20GB tar file itself. I want to break that in to multiple 1GB files....
you could use `split`...

If you use multi-volume you will also need to write a script to move the backup files or you will just have one disk1.tar file which is 1GB and holds the final slice of the backup.

Check out man split first. It may suit your needs...

If not I'll see if I can find an old multi volume tar script I used to use.

Can I ask.... why 1GB???

Avatar of ppeiris

ASKER

I will try to use split but I would like to use only the tar command. It seems like its a very default requirement what I am asking .... I am using 1GB  because I am transferring them over the internet using scp to diffident location. 1GB is convenion to me.
ASKER CERTIFIED SOLUTION
Avatar of Julian Parker
Julian Parker
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
oops; get rid of the ${NETHDD}/ reference on line 10.

You may need to tweak it for your setup...
...or backup your stuff into one large tar then;

   split -a 2 -b 1024m backupfile.tar

Alas, it has also been a long time since I used split (about the same as the script). I found split does not copy well with gzipped tar archives.... though it may be better now.

... have even more fun :-)