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
tar -cM --tape-length=1024000 --file=disk1.tar backup.tar /backupdirectory
ppeiris
ASKER
sorry ... in my case backup.tar is 20GB tar file itself. I want to break that in to multiple 1GB files....
Julian Parker
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.
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.
oops; get rid of the ${NETHDD}/ reference on line 10.
You may need to tweak it for your setup...
Julian Parker
...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.
tar -cM --tape-length=1024000 --file=disk1.tar backup.tar /backupdirectory