Tonic for your Backup Woes: CD Backups In Linux (Part Two) - Page 2
GNU tar (Tape Archiver) is the reliable old Unix archiving workhorse. Using tar with a compression utility such as gzip or the new tool bzip2, zillions more bits can be packed onto a disk. tar preserves permissions, hard and soft links, and directory structures. Here is a simple recipe for using tar to create a compressed archive to burn to disk:
# tar -cvzWf /monday_backup.tar.gz /home/carla/
Scripting is little more than stringing all the commands for a job together in one nice neat file. Plus, with scripting you can take advantage of additional elements to make a job easier, such as if/else statements, echos to screen, prompts, and error-handling.
tar is a funny little thing. It is not always necessary to use the single hyphen, as:
# tar cvzWf /monday_backup.tar.gz /home/carla/
is the same as the previous command (notice the lack of a single hyphen preceding "cvzfW"). But for tar commands with double hyphens, you must use them. It's best to play it safe and hyphenate everything correctly:
# tar --exclude=/home/carla/tmp -cvzWf /monday_backup.tar.gz /home/carla/
This example will archive, compress, and verify everything in carla's home directory, except /tmp. tar has many options for file selection which help allow for a finely-tuned backup.
Good Ole tar
# mkisofs -o monday_backup.iso -JrVv /monday_backup.tar.gz
# cdrecord -v -eject -multi speed=8 dev=0,1,0 monday_backup.iso