How To Split A Large Files To Multiple Parts Using “tar”.

Written by Jahangir on October 10, 2008 – 7:26 am -

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.


Tags: , , , , , ,
Posted in Dedicated Server Hosting, linux, Linux VPS Hosting | 8 Comments »

8 Comments to “How To Split A Large Files To Multiple Parts Using “tar”.”

  1. arnuld Says:

    This looks very cumbersome. Everytime typing the name sof all the volumes. Why not use split:


    $ split –verbose –bytes=5m -d check.mpg check


    creating file `check00′
    creating file `check01′
    creating file `check02′
    creating file `check03′
    creating file `check04′

    thats it. When you want to join just concatenate them


    $ cat check01 check02 check03 check04 > check.mpg

  2. split shot Says:

    [...] of the Winelands region of Cape Town. Taste internationally acclaimed wines while feasting your eyeHow To Split A Large Files To Multiple Parts Using tar …Here you have to use two extra command line options to split the file over multiple parts. … Below [...]

  3. Can I automate tar's multi-volume-feature? | Q&A System Says:

    [...] so I’ve just had a read through this page after a way to improve my current backup solution on my Debian server. Tar seems to be offering a [...]

  4. Jason Campos Says:

    If the file is particularly large:

    nohup split –verbose –bytes=1000m -d bigFile.tgz fileprefix &

  5. Can I Automate Tar’s Multi-volume-feature? | Click & Find Answer ! Says:

    [...] so I’ve just had a read through this page after a way to improve my current backup solution on my Debian server. Tar seems to be offering a [...]

  6. Can I automate tar's multi-volume-feature? | You need? We have! Everythings Says:

    [...] so I’ve just had a read through this page after a way to improve my current backup solution on my Debian server. Tar seems to be offering a [...]

  7. » Linux: Can I automate tar's multi-volume-feature? Says:

    [...] so I’ve just had a read through this page after a way to improve my current backup solution on my Debian server. Tar seems to be offering a [...]

  8. Unix:Can I automate tar's multi-volume-feature? – Unix Questions Says:

    [...] so I’ve just had a read through this page after a way to improve my current backup solution on my Debian server. Tar seems to be offering a [...]

Leave a Comment

RSS

  • Subscribe Me

  • Tag Cloud

  • Archives