Ubuntu: Using tar to span a backup across multiple tapes

 

Following on from the article on writing files to a tape backup, what happens if you want to back up more than what fits on a single tape? Here we want to use the –multi-volume switch, or -M. Use it so:

 

tar -cvMf /dev/[path-to-tape] [backup folder or files]

 

As a working example:

 

tar -cvMf /dev/st0 /opt/movies

 

Once the first tape is full, tar will prompt you to insert another:

 

Prepare volume #2 for `/dev/st0′ and hit return:

 

Make sure you replace the tape with another before hitting return or else it will over-write the just-finished tape!

 

With the exception of a file which sits across multiple tapes (think of a file which starts at the end of one tapes and finishes at the start of the next) you don’t need a first tape to restore the files on the second. You also cannot use compression for multi-volume archives.