Burning CDs with an ATAPI CD-RW Drive

Applicable to: FreeBSD 4.x

Updated: June 2, 2000

(Go to FreeBSD 3.x version)

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).





  1. Install the ATAPI CD-RW drive.

    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).


    1. Edit the kernel configuration file /usr/src/sys/i386/conf/YOURKERNEL and add support for the ATAPI drive:

      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.

    2. Shut down the computer and install the ATAPI CD-RW drive as the master drive on the secondary IDE controller.

  2. Reboot and verify that FreeBSD properly recognizes the CR-RW drive. You should see something similar to:

    acd0: CD-RW <Hewlett-Packard CD-Writer Plus 8200a> at ata1-master using PIO4

  3. Install the mkisofs port:

    # cd /usr/ports/sysutils/mkisofs && make && make install && make clean

  4. Manually create a data CD:

    1. Insert a blank CD-R disk in the CD-RW drive.

    2. Create an ISO filesystem. For this example, we'll create a backup of /usr/home and save it to the file /tmp/cd.iso:

      # 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!

    3. Prepare the CD-R for writing:


      # 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.

  5. To automate the process, use a script similar to the following, which I call burn (modify as appropriate for your system):

    
    #!/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

  6. For other ideas on how to use your ATAPI CD-RW drive, see the example scripts in /usr/share/examples/worm.







http://www.mostgraveconcern.com/freebsd/

Questions or Comments? Contact Us...





Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.