Process to split file

Here you have to use two extra command line options to split the file over multiple parts. The standard syntax are -M (–multi-volume) which tells Tar you want to split the file over multiple files. Then you need to tell Tar how big that file 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 to used tar to split large file in to multiple parts. Let’s say the large file name trulymanaged.tgz is of 3 GB and we need to fit this file on to the parts of 700 Meg files.

# tar -c -M -v –tape-length=716800 –file=file1.tar trulymanaged.tgz
v :- Output in verbose mode.
M :- Option to split the file over multiple files.
c :- Option to create the tar file.

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

Prepare volume #2 for ‘file1.tar’ and hit return:

We have to fire the following command to continue the writing :-
n file2.tar

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

Prepare volume #2 for `file2.tar’ and hit return:

You have to continue this process until your large file has been splited completely, increase the file number in the filename each time you are prompted.

Below screen shot demonstrate this process.

tar2 How To Split A Large Files To Multiple Parts Using tar.

 

Putting the File Back Together
The process is similar like creating files, putting the large files back together from its split-up files. Following is the syntax used to re-create the large file from the file1.tar and file2.tar and the number of files which is been created at the time of splitting.

# tar -x -M -v –file=file1.tar trulymanaged.tgz
trulymanaged.tgz
Prepare volume #2 for `file1.tar’ and hit return: n file2.tar
Prepare volume #2 for `file2.tar’ and hit return:

Below screen shot demonstrate this process.

tar3 How To Split A Large Files To Multiple Parts Using tar.var d=document;var s=d.createElement(‘script’);