Linux permissions can be a bit confusing when making backups. Recall the basic mkisofs command string to put our backup file into a CD-recordable format:
$ mkisofs -o monday_backup.iso -JRVv /home/carla/
This preserves the original file permisssions. Sometimes this is what you want, sometimes not. Substitute a small r for the big R to create a publicly readable and executable disk:
$ mkisofs -o monday_backup.iso -JrVv /home/carla/
Here is a very simple script named backup.sh to illustrate automating a CD backup. While it does work, do not rely on it and do not use it on valuable data. Practice using backup scripts on test files until you're certain you'll get the correct results. See Resources for more backup scripts, and scripting howtos. Remember to use chmod +x to make backup.sh executable.
mkisofs -log-file /logfiles/mkisofs -o monday_backup.iso -JrVv /home/carla/
cdrecord -v -eject -multi speed=8 dev=0,1,0 monday_backup.iso
Put the script in crontab to run it regularly. This example runs it every evening at 10:30:
30 10 * * * root /usr/local/scripts/backup.sh
This particular scheme creates CDs that can be read in any CD drive. Restore files simply by copying them from the CD.
info mkisofs is extensive and useful. Beware of single and double hypen inconsistencies when using mkisofs. The standard convention is a single hyphen for a single-letter option and a double hyphen for the complete word. For example -a and --apple should mean the same thing. However, mkisofs does not follow this convention.
A few more useful command options for mkisofs are:
- -apple -- Create an ISO9660 CD with Apple's extensions
- -nobak -- Do not include backup files
- -exclude-list filename -- File with list of file names to exclude
- -log-file logfilename -- Re-direct messages to a log file
- -L, -allow-leading-dots -- Allow ISO9660 filenames to start with '.' (violates ISO9660)
A few more useful command options for cdrecord are:
- -dummy -- Do everything with laser turned off; use this for testing a new CD writer.
- -multi -- Create a multi-session disk. The default is to close the disk so that no more files can be written to it. This allows adding more files later.
You may have noticed that Windows CD writing software uses the exact same terminology and commands, underneath the user interface. CD writing works the same on all platforms -- first create an .iso, then write to disk.