Archiving a large backup across multiple discs on Linux

 

Hopefully, we all back up our data, but what should we do once our data won't fit on our chosen media?

 

We have two options (as we obviously don't want to delete our data!)

  • Use a different backup medium
  • Split the backup across multiple volumes

Sometimes the former just isn't appropriate, as much because of the cost of harddrives vs Optical Media (i.e. CD's/DVD's).

This short tutorial will explain how to create a single backup archive, and then split it across multiple CD's/DVD's.

 

 

In this tutorial, I want to backup to DVD (as my photo collection would require more than 40 CD's).

So from BASH;

 

tar -cf Pictures_backup.tar Pictures/

split -d -b 4480m Pictures.backup.tar


This will then give you multiple files to burn to disc (each beginning with x). Burn these files with your favourite CD Burner

To restore the files, copy them all to one directory and then run the following

 

 cat * > Pictures_backup.tar

tar xvf Pictures_backup.tar

 

Notes

You can also create and split the archive in a single line, by piping tar through split. If you have the harddrive space and are disciplined enough to actually burn the files off regularly, you can write a fairly simple BASH script to call from your crontab;

 

#!/bin/bash


# Set where you want the Backup files to be stored

BACKUP_DIR="/var/tmp/"


cd /home/$USER/

tar -cf Pictures_backup.tar Pictures/ | split -d -b 4480m - Pictures_backup_$(date +%Y%m%d).tar

mv Pictures_backup_$(date +%Y%m%d).tar* $BACKUP_DIR

## Insert some magic here to email you and remind you to burn the discs

 

CD's

Whichever route you take around creating the split files, if you are wanting to split across CD's you need to alter the split command. In place of 4480m simply enter 680m.