This used to be useful for splitting files across multiple floppy disks, splitting archives across multiple tape drives, and other cases where individual media wasn’t big enough for what you’d normally bundle as a single file. Recently I had to look at this again to overcome limits on email attachments. I looked around for my old friend bsplit then remembered that tar can do the job (and is ubiquitous).
Unfortunately (but understandably) tar can’t compress and split at the same time, so first step is to compress my 107 MB file

bzip2 -9 ab.log

For splitting the tar archive into suitable chunks, I needed a multiple of 512 guaranteed to be less than 4 MB, so picked 3584:

tar cf ab.tar --multi-volume --tape-length=3584 ab.log.bz2
n ab-p2.tar

You then want to check that the archive is readable:

tar tf ab.tar --multi-volume
n ab-p2.tar

Reconstructing the original file(s) from the archive chunks is just a matter of changing the ‘t’ to an ‘x’:

tar xf ab.tar --multi-volume
n ab-p2.tar
Advertisements