Split and join large files using cat, split and tar

I was going to store a CentOS DVD iso file into my external hard drive but the image was bigger than 4GB, the biggest file size in FAT32, so I had to split it.

$ cat CentOS-6.5-x86_64-bin-DVD1.iso | split -b 2200m - CentOS-6.5-x86_64-bin-DVD1.iso-part-

This will generate files, each one of 2.2GB (except the last one that will be smaller), with these names:

CentOS-6.5-x86_64-bin-DVD1.iso-part-aa
CentOS-6.5-x86_64-bin-DVD1.iso-part-ab

You can join them with cat:

$ cat CentOS-6.5-x86_64-bin-DVD1.iso-part-* > CentOS-6.5-x86_64-bin-DVD1.iso

tar-split

You may also split and compress it on the fly with tar and it’s z option:

$ tar cvzf - CentOS-6.5-x86_64-bin-DVD1.iso | split -b 2200m - CentOS-6.5-x86_64-bin-DVD1.tar.gz-part-

And of course decompress and join:

$ cat CentOS-6.5-x86_64-bin-DVD1.tar.gz-part-* | tar xvzf -

You might also like

Backup and restore hard drive with “dd”
Look for the hard drives device with mount or sudo fdisk -l and unmount it. In my case it's going to...

Backup and restore hard drive with “dd”
Look for the hard drives device with mount or sudo fdisk -l and unmount it. In my case it's going to...

Stop Spotlight from indexing external hard drive
If you don't want Spotlight to index an external driver or a USB flash drive you only have to add an...

Make Raspbian run from an external USB hard drive or USB memory stick
Raspberry Pi can ONLY boot from the SD Card. If you want to use your Raspberry Pi from an external USB...

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.