*CDBackup - CD-R(W) Backup Utility

Status

The current release of cdbackup is 0.7.1. This program is made available under a BSD-style license, so feel free to make any modifications you wish. All I ask is that you leave the copyrights intact.

Download Page. See CHANGELOG for version information and changes.

What is it?

Cdbackup and cdrestore are utilities designed to make backups to CD-R(W)/DVD-R(W) media easier. They are designed to work with any backup and restore software that can read from stdin, write to stdout, and can handle linear devices such as tape drives. Dump/restore, cpio, afio, and tar should all work fine.

WARNING! When using this program under Linux, be sure not to use dump on a mounted filesystem. This has a high potential for creating corrupted backups. As of kernel version 2.4.19, this has not been fixed and it may not be fixed at all. Some time ago there was a discussion about this on the linux-kernel-mailinglist. You can read Linus statement here.

Requirements

  • Intel x86 computer running Linux
  • gcc to compile the software (tested with gcc 2.95 & 3.2.2)
  • A CD-R(W) drive supported by cdrecord or a DVD-R(W) drive supported by cdrecord-ProDVD
  • A recent version of cdrecord or cdrecord-ProDVD in your path
  • Other backup software such as tar, cpio, afio or dump/restore
This program should work on any system (PowerPC, Alpha, etc.) that supports Linux and cdrecord, although only x86 has been tested.

How does it work?

From the cdbackup/cdrestore help pages:

Usage: cdbackup [options ...] [-- cdrecord-options ...]
Reads from standard input, block formats and writes to CD-R(W).

  -d DEVICE      DEVICE for CD queries (default /dev/burner)
  -l N           set media size, disable auto-detect
  -r DEVICE      DEVICE for CD recording (e.g. 0,4,0)
  -s N           record CD at speed N (default 4)
  -X             enable CDROM XA2 mode in cdrecord
  -a LABEL       use LABEL as CD session title
  -p N           use a padsize of N sectors for the session (default 15)
  -m             enable multi-disk mode
  -c COMMAND     call COMMAND on disk change in multi-disk mode
  -C             disable checksum creation for datablocks
  -i IMAGE       use virtual image IMAGE for recording
  -w             dump virtual image to media
  -R             enables DVD mode
  -E EXE         set alternative cdrecord executable
  -v             be verbose
  -D             enable DEBUG output
  -V             prints version & exits
  --             pass rest of commandline to cdrecord

Usage: cdrestore [OPTION]...
Reads block input from CD-R(W) and writes it to standard output.

  -d DEVICE      DEVICE for CD queries (e.g. /dev/sr0)
  -q             query disk and print TOC only
  -t N           restore from track N
  -l N           set media size
  -c COMMAND     call COMMAND on disk change in multi-disk mode
  -T             don't restore, test data integrity only
  -F             force starting restore in the middle of a multi-disk set
  -R             set the kernel read-ahead to zero during restore
  -i IMAGE       use virtual image IMAGE for operation
  -v             be verbose
  -D             enable DEBUG output
  -V             prints version & exits

Typically, you will use the output of your favorite backup software as input for cdbackup. Should you need to restore the backup, you would feed the output of cdrestore into the restore program. For example, the following command would write the contents of the /home filesystem to the CD-RW on /dev/scd0 (scsi bus 2, device 0) and label it "/home backup" (note that this should be all on one line):

tar -cvf - /home | cdbackup -d /dev/scd0 -r 2,0 -l 700 -a "/home backup"

To restore this backup, you would use a command such as:

cdrestore -d /dev/scd0 -t 1 | tar -xv

Multiple backups can be created on a single cd - each will be written into a new track. To view the contents of a backup CD, enter this command:

cdrestore -d /dev/scd0 -q

Is it safe?

Probably, but if it blows up your computer, don't come running to me. It has been tested and works alright on my system. Your mileage may vary. Note that there is some error checking, but no error recovery. So a bad block on the CD will cost you dearly (any info after the bad block will be unreadable).

Feedback

Any feedback, ideas, bug reports (especially with fixes) and patches. You can mail me at s.huelswitt@gmx.de.