Sun Dublan
Troy's Notes for CD Burning in Linux/FreeBSD 

This document assumes your CDR in Linux is 8 speed and on scsi id 1,0 or /dev/scd0 and your CDROM is on /dev/hda

CD Copying

  • To copy from a cd to a cd, place the master in the CDROM drive and the CD-R in the burn drive and:

    dd if=/dev/hda | cdrecord -v -eject speed=8 dev=1,0 -

  • DON'T do this:

    cdrecord -v -eject speed=8 dev=1,0 /dev/hda

    It will work to some extent, but it may fail. You need dd's buffer.

ISOs

  • To record a cd from an iso, do this:

    cdrecord -v -eject speed=8 dev=1,0 <image_file>

  • Burning a CD in FreeBSD? It's all simpler. You don't even have to have a SCSI CDR. Look at the burncd manpage. There's a lot of good info with examples there. One thing that I use a lot is to burn an ISO of FreeBSD or whatever, like this (supposing your CDR is 16 speed on /dev/acd0c):

    burncd -e -f /dev/acd0c -s 16 -v data <iso_image> fixate

Files to ISOs

  • To make an ISO/Joliet/RockRidge filesystem:

    mkisofs -J -R -V "<volume name>" -o <outfile> <directory>

  • To create an isofs and pipe it to cdrecord:
    (remove the "\" at the end of line one to put it all on one line)

    mkisofs -J -R -V "<volume name>" <directory> | \
    cdrecord -v -eject speed=8 dev=1,0 -

  • To create a bootable iso, you need to first get an image of a bootable floppy by dd'ing it just how you dd a CD to get its image. Place the bootable image somewhere on the filesystem that will comprise the ISO you're creating. Then, run this command to create the ISO:

    mkisofs -R -J -V "<volume name>" -b <relative path>/<boot image> \
    -c <relative path>/<catfile> -o <outfile> <directory>

    The catfile is created as it creates the iso. You're just telling it where to put it.

  • For example, to create the microsoft operating systems bootable CD, I had a file named boot.img in a subdirectory called "boot" under the directory of which I want to make an ISO image. I'd ran this command:

    mkisofs -R -J -V "M\$-OpSys" -b boot/boot.img -c boot/boot.cat -o \
    ms-os.iso ~/MS-OS/

ISO to File

  • To create an ISO image file from a CDROM:

    (from burner) dd if=/dev/scd0 of=<filename>
    (from reader) dd if=/dev/hda of=<filename>

Audio

  • To burn an audio track:

    cdrecord -v speed=8 dev=1,0 -nofix -audio -pad <wavefile.wav>

  • If you burn audio tracks one by one, (like above) remember to:

    cdrecord -v speed=8 dev=1,0 -fix

    to fixate, or remove -nofix on your last song or group of songs.

  • To burn all wavs in a directory and eject when done:

    cdrecord -v speed=8 dev=1,0 -eject -audio -pad *.wav

  • To check if a directory of wavs is too big for one cd
    (650M = 665,600KB, 681,574,400B; 700M = 716,800KB, 734,003,200B):

    du -sk <directory>

    e.g.:

    perl -le 'if(`du -ks`>1024*700){print"Sorry"}else{print"Ok!"}'

MP3 Decoding

  • To decode an mp3 for cd burning:

    mpg321 <file.mp3> --wav - | sox -t wav - <file.cdr>

    e.g.:

    perl -le 'for (<*.mp3>) { $out = $_; $out =~ s/\.mp3$/\.raw/;\
    sysetm qq{mpg321 "$_" --wav - | sox -t wav - "raw/$out" }; }'

  • To decode an mp3 and record it in the same command (untested);

    mpg321 --wav - <file.mp3> |\
    sox -t wav - -t cdr - |\
    cdrecord -v speed=8 dev=1,0 -nofix -audio -pad -

    (remember to 'cdrecord -v speed=8 dev=1,0 -fix' to fixate when done)

ISO Mounting

  • FreeBSD:

    vnconfig /dev/vn0c <iso_image>
    mount -t cd9660 /dev/vn0c /cdrom

    When you're finished with the image, here's how you reverse the above:

    umount /cdrom
    vnconfig -u /dev/vn0c

  • Linux:

    mount <iso_image> -r -t iso9660 -o loop /mnt/directory


For a test run of cdrecord, insert "-dummy" in the options
10/1/2004 Webmaster: Troy Bowman