What is the command to simply archive a file in multiple volumes with tar.
I have a file called file0, I want to archive it with tar so that file0 is split in tar files of let us say 10MB. How can I simply do that ? The GUI of Ubuntu has the option "Split" (for tar) greyed out.
Asked
Active
Viewed 752 times
1
1 Answers
1
A simple way is to just tar the file, print the archive to standard output and pass it through split:
tar czpf - file0 | split -d -b 10M - file0
Note that this isn't quite what you tried. The command you have in your comment (tar czpf - . | split -d -b 10M - file0) was using . as input. That means that the input "file" for tar, the current directory, changed as soon as split started writing its output files into the current directory, so tar complained. To avoid that, either give tar the file name as I did above, or run this from another directory:
cd /some/place
tar czpf - /path/to/dir/containing/file0 | split -d -b 10M - file0
In both cases, to untar the file, you'll have to cat the files to join them:
cat file00* | tar xzvf -