How can I create multipart tar file in Linux?
--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Drifting Through My Dreams
--
Chapters
00:00 How Can I Create Multipart Tar File In Linux?
00:12 Answer 1 Score 0
00:29 Accepted Answer Score 38
00:49 Answer 3 Score 4
01:13 Thank you
--
Full question
https://superuser.com/questions/198857/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #commandline #tar
#avk47
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Drifting Through My Dreams
--
Chapters
00:00 How Can I Create Multipart Tar File In Linux?
00:12 Answer 1 Score 0
00:29 Accepted Answer Score 38
00:49 Answer 3 Score 4
01:13 Thank you
--
Full question
https://superuser.com/questions/198857/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#linux #commandline #tar
#avk47
ACCEPTED ANSWER
Score 38
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 -
ANSWER 2
Score 4
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"
ANSWER 3
Score 0
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.