Creating and extracting multivolume tar files

Some servers do not support files larger than 2GB, also when creating archives larger than 2GB most probably server will run out of memory or other resources. So is best to split large archives in multiple files. This is a good way to move large sites to another server.

Creating the multivolume tar file

If for example you have a folder "my_documents" and you want to create multivolume tar archive with its contents, this command will start archiving it and will split the files to 1.2GB:

tar -cML 1258291 -f my_documents.tar my_documents

When first file reached 1.2GB (after some minutes) it will display a prompt to move to next file, it will ask if volume #2 for this archive is ready, type this answer, notice the "2":

n my_documents2.tar

press enter, it will ask if files are ready, press enter again to confirm without typing anything. On next prompt type "n my_documents3.tar" and press enter twice again, and so on. You should now have multiple files of maximum 1.2GB named: my_documents.tar, my_documents2.tar, my_documents3.tar.

Unlike with zip files, it doesn't seem to be a command for testing multivolume tar files.

If you created the files in order to move a large site, I would recommend to move them with wget triggered from destination server:


You should do some basic testing to compare file integrity if copied from another server, for example use "cksum my_documents.tar" on old and new server to make sure it returns same result, meaning that files are the same.

To unpack the multivolume tar archive

Use this command to unpack the multivolume tar archive, this would probably hapen on the new server if you moved a site:

tar -xMf my_documents.tar

After some work (minutes on most servers), it will ask for next file, type this:

n my_documents2.tar

Then on next question type n my_documents3.tar, etc.

Creating single tar files:

To create one single tar file, for example archiving "images" folder:

tar -cvf images.tar images

unpack single files (not multivolume) with this command:

tar -xvf images.tar