I need to backup a fairly large directory, but I am limited by the size of individual files. I'd like to essentially create a tar.(gz|bz2)
archive which is split into 200MB maximum archives. Clonezilla does something similar to this by splitting image backups named like so:
sda1.backup.tar.gz.aa
sda1.backup.tar.gz.ab
sda1.backup.tar.gz.ac
Is there a way I can do this in one command? I understand how to use the split
command, but I'd like to not have to create one giant archive, then split it into smaller archives, as this would double the disk space I'd need in order to initially create the archive.
Best Answer
You can pipe tar to the split command:
On some *nix systems (like OS X) you may get the following error:
In that case try this (note the
-b 200m
):If you happen to be trying to split the file to fit on a FAT32 formatted drive, use a byte limit of 4294967295. For example:
When you want to extract the files use the following command (as of @Naftuli Kay commented):