21
10
How can I create a multipart tar file in Linux?
21
10
How can I create a multipart tar file in Linux?
29
You can use the split
command to split an archive in to multiple files. For example, if I wanted my archive stored in 1 MByte files:
tar -cvf - <stuff to put in archive> | split --bytes=1m --suffix-length=4 --numeric-suffix - myarchive.tar.
And when I want to recombine and untar:
cat myarchive.tar.* | tar xvf -
1in gnu split, --numeric-suffixes is the param. – kevinf – 2016-11-23T05:00:16.550
2
GNU Tar natively supports multiple volumes. There are many options, the one I found neat was
tar --create --multi-volume --file=/tmp/file1.tar --file=/tmp/file2.tar files_to_archive
size can be specified via -L (tape-length)
It does not support compression in this manner however, so you would have to seperately do that. "tar: Cannot use multi-volume compressed archives"
1
Use tar c
to create the tar archive, and specify the k size-in-kbytes
parameter to control the maximum size of each part. You'll end up with ((original size)/(part size) + 1) parts.
Arch Linux, tar (GNU tar) 1.29
, I see no such option too. – Ivan Kolmychek – 2016-09-30T09:17:33.233
Where did you get the "k size-in-kbytes parameter"? Can't seem to find it on Linux. – sleske – 2010-10-13T00:30:45.167
saw it here: http://www.computerhope.com/unix/utar.htm
– Traveling Tech Guy – 2010-10-13T04:08:08.5201Not in Gentoo linux, unfortunately. – hopeseekr – 2010-10-13T16:53:12.547
Related How to split a tar file into smaller parts at file boundaries?
– Sathyajith Bhat – 2010-10-13T00:15:39.7771Similar, but not the same. The linked question @Sathya points to is more complex and requires a more complicated solution. – Ian C. – 2010-10-13T19:46:30.203