domingo, setembro 10, 2006

Splitting Large Files to Span Multiple Disks using TAR

The two extra command line options you need to use over and above the standard syntax are -M (--multi-volume) which tells Tar you want to split the file over multiple media disks. You then need to tell Tar how big that media is, so that it can create files of the correct size. To do this you use the --tape-length option, where the value you pass is number x 1024 bytes.

The example below shows the syntax used. Lets say the largefile.tgz is 150 Meg and we need to fit the file on two 100 Meg Zip drives.

tar -c -M --tape-length=102400 --file=disk1.tar largefile.tgz

The value 102400 is 1024 x 100, which will create a 100 Meg file called disk1.tar and then Tar will prompt for volume 2 like below :-

Prepare volume #2 for disk1.tar and hit return:

In the time of tape drives you would have taken the first tape out of the machine and inserted a new tape, and pressed returned to continue. As we want Tar to create the remaining 50 Meg in a separate file, we issue the following command :-

n disk2.tar

This instructs Tar to continue writing the remaining 50 Meg of largefile.tgz to a file named disk2.tar. You will then be prompted with the line below, and you can now hit return to continue.

Prepare volume #2 for disk2.tar and hit return:

You would repeat this process until your large file has been completely processed, increasing the disk number in the file each time you are prompted.

Other example:
tar cvf arq1.tar -M --tape-length=500000 bigarq.txt


Putting the File Back Together

The process is similar when putting the large file back together from its split-up files. Below is the syntax used to re-create the large file from the disk1.tar and disk2.tar images.

C:\tar>tar -x -M --file=disk1.tar largefile.tgz
Prepare volume #2 for disk1.tar and hit return: n disk2.tar
Prepare volume #2 for disk2.tar and hit return:


Source: http://www.cgi-interactive-uk.com/splitting_large_files.html

Nenhum comentário: