This Sheet describes the method used to create data CDs on an ATAPI CD-RW drive. Before you begin, you should review the manual pages for mkisofs(8) and burncd(8).
Make sure the CD-RW drive is not installed on the same IDE controller as the hard drive that will be used to create the ISO filesystem image, or you will not be able to write to the CD-RW drive properly. For this example, the hard drive is the master drive on the primary IDE controller (ata0) and the CD-RW drive is the master on the secondary IDE controller (ata1).
device ata0 at isa? port IO_WD1 irq 14 device ata1 at isa? port IO_WD2 irq 15 device ata device atadisk # ATA disk drives device atapicd # ATAPI CDROM drives
For more information on these options, please read the file /usr/src/sys/i386/conf/LINT.
Recompile the kernel. Refer to the Building a Custom Kernel cheat sheet for information on recompiling your kernel.
acd0: CD-RW <Hewlett-Packard CD-Writer Plus 8200a> at ata1-master using PIO4
# cd /usr/ports/sysutils/mkisofs && make && make install && make clean
# mkisofs -d -N -D -R -L -l -J -T -o /tmp/cd.iso /usr/home
Refer to the mkisofs(8) man page for a description of the options used above.
Note: Make sure your ISO file is less than 650MB, or it won't fit on the CD!
# burncd -f /dev/acd0c -s 4 -e data /tmp/cd.iso fixate
The '-s 4' option sets 4x write speed; the '-e' option ejects the CD once the recording session is complete.
#!/bin/sh
#
# burn - Burn a backup CD-R.
#
# Maintained by: D. N. O'Connor.
# Modified: 6/2/2000.
#
# This script creates a backup CD of:
# root - Entire root filesystem, not including other filesystems that
# can be backed up here, or that can be easily replaced, like
# the source files and the ports collection. This option does,
# however, make a backup of the kernel config files.
# home - Backs up the home directories under /usr/home.
# samba - Backs up the Samba shared directories under /usr/smbshares.
# <tree> - Backs up the directory tree <tree>.
# CD Burner:
device=/dev/acd0c
# Copyright string (use for date of backup):
copr="`date`"
if [ -n "${1}" ]; then
case ${1} in
[Rr]|Root|root)
title="Root"
tree="/"
exclude="-x /proc -x /cdrom -x /etc.old -x /usr/obj -x /usr/home
-x /usr/smbshares -x /usr/ports -x /usr/tmp -x /usr/var/spool
-x /usr/var/mail" (All one line)
if [ ! -d /etc/usr.src.sys.i386.conf ]; then
echo "Creating /etc/usr.src.sys.i386.conf..."
mkdir /etc/usr.src.sys.i386.conf
fi
echo "Saving kernel config files to /etc/usr.src.sys.i386.conf..."
cp -p /usr/src/sys/i386/conf/* /etc/usr.src.sys.i386.conf/
;;
[Hh]|Home|home)
title="Home"
tree="/usr/home"
exclude=""
;;
[Ss]|Samba|samba)
title="Samba"
tree="/usr/smbshares"
exclude=""
;;
# Other tree to backup
*)
title="Backup"
tree=${1}
;;
esac
echo ""
echo Making \"${title}\" CD-R for date ${copr}
(echo ""; echo "Creating ISO filesystem..." )
mkisofs -d -N -D -R -l -J -L -T -V "${title}" -P "${copr}" -o /tmp/cd.iso ${exclude} ${tree} \
&& (echo ""; echo "Burning the CD..." ) \
&& burncd -f ${device} -s 4 -e data /tmp/cd.iso fixate \
&& rm /tmp/cd.iso \
&& (echo ""; echo "Run complete." )
else
echo "Usage: burn keyword | file-tree"
echo ""
echo "where: keyword is one of:"
echo " root - create a backup of the Root '/' filesystem;"
echo " home - create a backup of user home directories; or"
echo " samba - create a backup of the SMB shared directories."
echo " file-tree is a directory path to backup."
echo ""
fi