NAME

     cdrecord - record audio or data Compact Discs from a master


SYNOPSIS

     cdrecord [ general options ] dev=device [  track  options  ]
     track1...trackn



DESCRIPTION

     Cdrecord is used to record data or audio Compact Discs on an
     Orange Book CD-Recorder.

     The device refers to scsibus/target/lun of the  CD-Recorder.
     Communication  on SunOS is done with the SCSI general driver
     scg. Other operating systems are using a library  simulation
     of    this    driver.     Possible    syntax    is:     dev=
     scsibus,target,lun or dev= target,lun.  In the latter  case,
     the  CD-Recorder has to be connected to the default SCSI bus
     of the machine.

     Scsibus,  target  and  lun  are  integer  numbers.  To  make
     cdrecord  portable to all UNIX platforms, there is no way to
     specify a real device file name.  Scsibus 0 is  the  default
     SCSI  bus  on  the machine. Watch the boot messages for more
     information or look into /var/adm/messages for more informa-
     tion about the SCSI configuration of your machine.

     Each track corresponds to a single file  that  contains  the
     prepared data for that track.  If the argument is `-', stan-
     dard input is used for that track. There  may  only  be  one
     track that is taken from stdin.



GENERAL OPTIONS

     General options must be before any track file name or  track
     option.

     -version
          Print version information and exit.

     -v    Be verbose during work, display the  progress  of  the
          writing process.

     -V    Be verbose in respect of SCSI command transport.  This
          helps  to  debug  problems  during the writing process,
          that occur in the CD-Recorder. If you get  incomprehen-
          sible  error  messages  you should use this flag to get
          more detailed output.  Using -V slows down the  process
          and may be the reason for a buffer underrun.

     -debug
          Print additional debug messages. This may help to  find
          out problems with sector sizes and sector types.  Using
          -debug slows down the process and may be the reason for
          a buffer underrun.

     -dummy
          The CD-Recorder  will  go  through  all  steps  of  the
          recording  process,  but the laser is turned off during
          this procedure.  It is recommended to run several tests
          before  actually writing to a Compact Disk, if the tim-
          ing and load response of the system is not known.

     -multi
          Allow multi session CD's to be made. This flag needs to
          be  present  on  all  sessions of a multi session disk,
          except you want to create a session that  will  be  the
          last  session  on the media.  The fixation will be done
          in a way that allows the CD-Recorder  to  append  addi-
          tional sessions later. This is done by generation a TOC
          with a link to the next program area. The so  generated
          media is not 100%  compatible to manufactured CD's. Use
          only for recording a multi session CD.  If this  option
          is present, the default track type is CD-ROM XA mode 2.
          The Sony drives have no hardware support for CD-ROM  XA
          mode  2.  You have tp specify the -data option in order
          to create multi session disks on these drives.

     -msinfo
          Retrieve multi session info  in  a  form  suitable  for
          mkisofs-1.10 or later.

     -toc  Retrieve and print out the table of content or PMA  of
          a CD.  With this option, cdrecord will work also with a
          CD-Rom drive.

     -fix  The disk will only be fixated (i.e. a TOC  for  a  CD-
          Reader  will be written). This may be used, if for some
          reason the disk has been written but not fixated.

     -nofix
          Do not fixate the disk after writing the  tracks.  This
          may be used to create an audio disk in steps. An unfix-
          ated disk can usually not be used on  a  non  CD-writer
          type  drive but there are audio CD players that will be
          able to play such a disk.

     -eject
          Eject disk after doing the work.   Some  Devices  (e.g.
          Philips) need to eject the medium before creating a new
          disk. Doing a -dummy test and  immediately  creating  a
          real disk would not work on these devices.

     speed=#
          Set the speed factor of the writing process to #.  # is
          an integer, representing a multiple of the audio speed.
          This is about 150 KB/s for CD-ROM and  about  172  KB/s
          for  CD-Audio.  If no speed option is present, cdrecord
          will try to get the  speed  value  from  the  CDR_SPEED
          environment.   If  your drive has problems with speed=2
          or speed=4, you should try speed=0.

     dev=target
          Sets the SCSI target for  the  CD-Recorder,  see  notes
          above.   If no dev option is present, cdrecord will try
          to get the device from the CDR_DEVICE environment.

     driver=name
          Allows to use a user supplied driver name for the  dev-
          ice.    To   get   a   list  of  possible  drivers  use
          driver=help.  The reason  for  the  existence  of  this
          option  is  to  allow users to use cdrecord with drives
          that are similar to  supported  drives  but  not  known
          directly  by  cdrecord.   Use  this option with extreme
          care. If a wrong driver is used for a device, the  pos-
          sibility  of  creating  corrupted  disks  is high.  The
          minimum problem related to a wrong driver is that the -
          speed or -dummy will not work.

     -checkdrive
          Checks if a driver for the current drive is present and
          exit.   If  the  drive  is a known drive, cdrecord uses
          exit code 0.

     -inq  Do an inquiry for the drive, print  the  inquiry  info
          and exit.

     -scanbus
          Scan all SCSI devices on all SCSI busses and print  the
          inquiry  strings.  This option may be used to find SCSI
          address of the CD-Recorder on a system.



TRACK OPTIONS

     Track options may be mixed with track file names.

     -audio
          If this flag is  present,  all  subsequent  tracks  are
          written  in  CD-DA  (similar to Red Book) audio format.
          The file with  data  for  this  tracks  should  contain
          stereo, 16-bit digital audio with 44100 samples/s.  The
          byte order should be the following: MSB left, LSB left,
          MSB  right,  LSB  right,  MSB left and so on. The track
          should be a multiple of 2352 bytes. It is not  possible
          to put the master image of an audio track on a raw disk
          because data will be read in  multiple  of  2352  bytes
          during  the  recording  process.  The audio data stream
          must not have any headers.  Using  audio  data  formats
          with  headers as input to cdrecord will usually work if
          the structure of the data is  the  structure  described
          above  but  you  will  hear  a  click at the start of a
          track.

     -swab
          If this flag is present, swapped audio data may be used
          for  writing  to  CD.   Some  types  of CD-Writers e.g.
          Yamaha, Sony and the new SCSI-3/mmc  drives  are  using
          the  wrong byte order for audio data, ignoring the fact
          that the SCSI-protocol otherwise correctly uses network
          (big  endian)  byte  order.  Cdrecord  knows  if  a CD-
          Recorder needs byte  swapping  and  corrects  the  byte
          order  of  the  data stream to the byte order described
          with the -audio flag.  You only need the -swab flag  if
          your  data stream is in Intel byte order. Note that the
          verbose output of cdrecord instead will not show you if
          the -swab flag was present for a track.  Cdrecord shows
          you if it really needs to swab that track.

     -data
          If this flag is  present,  all  subsequent  tracks  are
          written in CD-ROM mode 1 (Yellow Book) format. The data
          is a multiple of 2048 bytes.  The file with track  data
          should  contain  an  ISO-9660  or Rock Ridge filesystem
          image (see mkisofs for more details). If the track data
          is an ufs filesystem image, fragment size should be set
          to 2 KB or more to allow CR-drives  with  2  KB  sector
          size to to be used for reading.

          -data is the default, if no other flag is present.

     -mode2
          If this flag is  present,  all  subsequent  tracks  are
          written in CD-ROM mode 2 format. The data is a multiple
          of 2048 bytes.

     -xa1  If this flag is present,  all  subsequent  tracks  are
          written  in CD-ROM XA mode 1 format. The data is a mul-
          tiple of 2048 bytes.

     -xa2  If this flag is present,  all  subsequent  tracks  are
          written  in CD-ROM XA mode 2 format. The data is a mul-
          tiple of 2048 bytes.

     -cdi  If this flag is present,  all  subsequent  tracks  are
          written  in  CDI format. The data is a multiple of 2048
          bytes.

     -isosize
          Use the ISO-9660 file system size as the  size  of  the
          next  track.  This option is needed if you want to read
          the image of a track from a raw disk partition or on  a
          master  CD.  In  the  first case the option -isosize is
          needed to limit the size of the CD to the size  of  the
          iso filesystem.  In the second case the option -isosize
          is needed to prevent cdrecord from reading the two  run
          out  blocks  that  are  appended by each CD-recorder in
          track at once mode. These two run out blocks cannot  be
          read and would cause a buffer underrun that would cause
          e defective copy.  Do not use this option  if  cdrecord
          reads the track data from stdin.  This option currently
          cannot be used to determine the size of a  file  system
          if the multi session option is present.

     -pad  If the track is a data track,  15  sectors  of  zeroed
          data  will  be added to the end of this and each subse-
          quent data track.  Use this option if your CD-drive  is
          not  able to read the last sectors of a track or if you
          want to read to be able to read the CD on a Linux  sys-
          tem with the iso9660 filesystem read ahead bug.  If the
          -pad option refers to an audio track, cdrecord will pad
          the  audio  data  to  be  a multiple of 2352 bytes. The
          audio data padding is done with binary zeroes which  is
          equal to absolute silence.

     -nopad
          Do not pad the following tracks - the default.

     -preemp
          If this flag is present, all TOC entries for subsequent
          audio tracks will indicate that the audio data has been
          sampled with 50/15 µsec preemphasis.  The data, however
          is not modified during the process of transferring from
          file to disk. This option has no effect on data tracks.

     -nopreemp
          If this flag is present, all TOC entries for subsequent
          audio tracks will indicate that the audio data has been
          mastered with linear data - this is the default.

     bytes=#
          If the master image for the next track has been  stored
          on  a  raw  disk,  use this option to specify the valid
          amount of data on this disk. If the image of  the  next
          track  is  stored  in  a regular file, the size of that
          file is taken to determine the length  of  this  track.
          If  the track contains an ISO 9660 filesystem image use
          the -isosize option to determine  the  length  of  that
          filesystem image.



EXAMPLES

     For all examples below, it will  be  assumed  that  the  CD-
     Recorder  is  connected  to  the  primary  SCSI  bus  of the
     machine. The SCSI target id is set to 2.

     To record a pure CD-ROM at double speed, using data from the
     file cdimage.raw:

         cdrecord -v speed=2 dev=2,0 cdimage.raw

     To create an image for a ISO 9660 filesystem with Rock Ridge
     extensions:

         mkisofs -R -o cdimage.raw /home/joerg/master/tree

     To check the resulting file before writing to CD on Solaris:

         mount -r -F fbk -o type=hsfs /dev/fbk0:cdimage.raw /mnt

     On Linux:

         mount cdimage.raw -r -t iso9660 -o loop /mnt

     Go on with:
         ls -lR /mnt
         umount /mnt

     If the overall speed of the system  is  sufficient  and  the
     structure  of  the  filesystem  is not too complex, cdrecord
     will run without creating an image of the ISO 9660  filesys-
     tem. Simply run the pipeline:

         mkisofs -R /master/tree | cdrecord -v speed=2 dev=2,0 -

     If your system is loaded, you should run mkisofs in the real
     time  class  too.   To raise the priority of mkisofs replace
     the command

         mkisofs -R /master/tree
     by
         priocntl -e -c RT -p 59 mkisofs -R /master/tree

     on Solaris and by

         nice -18 mkisofs -R /master/tree

     on SunOS.

     Cdrecord runs at priority 59  on  Solaris,  you  should  run
     mkisofs  at  no  more than priority 58. On SunOS, you should
     run mkisofs at no less than nice -18.

     Creating a CD-ROM without file system image on disk has been
     tested  on  a  Sparcstation-2  with a Yamaha CDR-100. It did
     work up to double speed.  A faster machine may  be  able  to
     handle quad speed also.

     To record a pure CD-DA (audio) at single  speed,  with  each
     track   contained   in   a   file   named   track01.cdaudio,
     track02.cdaudio, etc:

         cdrecord -v speed=1 dev=2,0 -audio track*.cdaudio

     To check if it will be ok to use double speed for the  exam-
     ple above. Use the dummy write option:

         cdrecord -v -dummy speed=2 dev=2,0 -audio track*.cdaudio

     To record a mixed-mode CD with an ISO 9660  filesystem  from
     cdimage.raw on the first track, the other tracks being audio
     tracks from the files track01.cdaudio, track02.cdaudio, etc:

         cdrecord  - v  - dummy  dev=2,0   cdimage.raw   -  audio
     track*.cdaudio



SEE ALSO

     mkisofs(1), scg(7), fbk(7).



NOTES

     The current version of cdrecord will only  record  track  at
     once  Discs.   If  the  so  made disks contain more than one
     track, they are not suitable for direct mass  production  by
     CD  manufacturers.  You will need the disk at once option to
     record  such  disks.   Nevertheless  the  disks  made   with
     cdrecord  will  normally be read in all CD players. Some old
     audio CD players however may  produce  a  two  second  click
     between two audio tracks.

     The minimal size of a track is 4 seconds or 300 sectors.  If
     you  write  smaller  tracks,  the CD-Recorder will add dummy
     blocks. This is not an error,  even  though  the  SCSI-error
     message looks this way.

     Cdrecord has been tested  on  an  upgraded  Philips  CDD-521
     recorder at single and double speed on a SparcStation 20/502
     with no problems, slower computer systems should work  also.
     The  newer  Philips/HP/Plasmon/Grundig  drives  as  well  as
     Yamaha CDR-100 and CDR-102 work also.  The  Plasmon  RF-4100
     work,  but  has not tested in multi session.  A Philips CDD-
     521 that has not been upgraded  will  not  work.   The  Sony
     CDU-924  has  been  tested, but does not support XA-mode2 in
     hardware.  The sony therefore cannot create conforming multi
     session  disks.   The  Ricoh RO-1420C works, but some people
     seem to have problems to use them with speed=2, try  speed=0
     in this case.

     The Yamaha CDR-400 and all new SCSI-3/mmc conforming  drives
     are  supported  in  single  and multi-session.  CD-RW drives
     like the Ricoh  MP-6200  are  currently  supported  as  CD-R
     drives  only.  Erasing the disk or parts of the disk will be
     added in a later version of cdrecord.

     You should run several tests in all supported speeds of your
     drive  with  the   - dummy option turned on if you are using
     cdrecord on an unknown system. Writing a CD  is  a  realtime
     process. You can currently not use cdimages that are located
     on NFS file systems.  NFS will not  deliver  constantly  the
     needed data rates.  I used cdrecord with with medium load on
     a SS20/502 and even at quad speed on a Sparcstation-2  which
     was  heavily loaded, but it is recommended to leave the sys-
     tem as lightly  loaded  as  possible  while  writing  a  CD.
     Cdrecord needs to run as root to get access to the /dev/scg?
     device nodes and to be able to lock itself into memory.

     If you don't want to allow users to become root on your sys-
     tem, cdrecord may safely be installed suid root. This allows
     all users or a group of users with no root privileges to use
     cdrecord.  Cdrecord  in  this  case checks, if the real user
     would have been able to read the specified files.   To  give
     all user access to use cdrecord, enter:

          chmod 4711 /usr/local/bin/cdrecord

     To give a restricted  group  of  users  access  to  cdrecord
     enter:

          chmod 4710 /usr/local/bin/cdrecord
          chgrp cdburners /usr/local/bin/cdrecord

     and add a group cdburners on your system.

     Never give write permissions  for  non  root  users  to  the
     /dev/scg?   devices   unless  you  would  allow  anybody  to
     read/write/format all your disks.

     You should not  connect  old  drives  that  do  not  support
     disconnect/reconnect  to  either  the  SCSI bus that is con-
     nected to the CD-Recorder or the source disk.

     A Compact Disc can have no more than 99 tracks.

     When creating a disc with both audio and  data  tracks,  the
     data  should  be  on  track  1 otherwise wou should create a
     CDplus disk which is a multi session  disk  with  the  first
     session  containing  the audio tracks and the following ses-
     sion containing the data track.

     Many operating systems are not able to read more than a sin-
     gle data track, or need special software to do so.

     More information on the SCSI command set of a HP CD-Recorder
     can be found at:

          http://www.hp.com/isgsupport/cdr/index.html

     If you have more information or  SCSI  command  manuals  for
     other CD-Recorders than Philips CDD 522 or the HP drive men-
     tioned above please contact the author.

     The Philips CDD 521 CD-Recorder (even in the  upgraded  ver-
     sion) has several firmware bugs. Some of them will force you
     to power cycle the device or to reboot the machine.

     When using cdrecord  with  the  broken  Linux  SCSI  generic
     driver.  You  should  note  that  cdrecord uses a hack, that
     tries to  emulate  the  functionality  of  the  scg  driver.
     Unfortunately,  the  sg  driver  on Linux has several severe
     bugs:

     o     It cannot see if SCSI command could  not  be  sent  at
          all.

     o     It cannot get the SCSI status byte. Cdrecord for  that
          reason  cannot  report  failing  SCSI  commands in some
          situations.

     o     It cannot get real dma  count  of  transfer.  Cdrecord
          cannot tell you if there is an dma residual count.

     o     It cannot get number of  bytes  valid  in  auto  sense
          data.   Cdrecord cannot tell you if device transfers no
          sense data at all.

      o     It  fetches  to  few  data  in  auto  request   sense
          (CCS/SCSI-2/SCSI-3 needs >= 18).



DIAGNOSTICS

     You have 9 seconds to type ^C to abort  cdrecord  after  you
     see the message:

     Starting to write CD at speed %d in %s mode for %s session.

     A typical error message for a SCSI command looks like:

          cdrecord: I/O error. test unit ready: scsi sendcmd: no error
          status: 0x2 (CHECK CONDITION)
          Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 25 00 00 00 00 00
          Sense Key: 0x5 Illegal Request, Segment 0
          Sense Code: 0x25 Qual 0x00 (logical unit not supported) Fru 0x0
          Sense flags: Blk 0 (not valid)

     The first line gives information about the transport of  the
     command.   The  text  after  the first colon gives the error
     text for the system call from the view  of  the  kernel.  It
     usually  is:   I/O  error  unless other problems happen. The
     next words contain a short description for the SCSI  command
     that fails. The rest of the line tells you if there were any
     problems for the transport of the command over the SCSI bus.
     fatal  error means that it was not possible to transport the
     command (i.e.  no  device  present  at  the  requested  SCSI
     address).

     The second line gives information on the  SCSI  status  code
     returned  by  the  command,  if the transport of the command
     succeeds. This is error information from the SCSI device.

     The third line is a hex  dump  of  the  auto  request  sense
     information for the command.

     The fourth line is the error  text  for  the  sense  key  if
     available, followed by the segment number that is only valid
     if the command was a copy command. If the error  message  is
     not  directly  related  to  the  current  command,  the text
     deferred error is appended.

     The fifth line is the error text for the sense code and  the
     sense  qualifier if available.  If the type of the device is
     known, the sense data is decoded from tables in scsierrs.c .
     The text is followed by the error value for a field replace-
     able unit.

     The sixth line prints the block number that  is  related  to
     the  failed  command  and  text for several error flags. The
     block number may not be valid.

     The following message is not an error:
          Track 01: Total bytes read/written: 2048/2048 (1 sectors).
          cdrecord: I/O error. flush cache: scsi sendcmd: no error
          status: 0x2 (CHECK CONDITION)
          Sense Bytes: F0 00 05 80 00 00 27 0A 00 00 00 00 B5 00 00 00 00 00
          Sense Key: 0x5 Illegal Request, Segment 0
          Sense Code: 0xB5 Qual 0x00 (dummy data blocks added) Fru 0x0
          Sense flags: Blk -2147483609 (valid)

     It simply notifies, that a track that is  smaller  than  the
     minimum size has been expanded to 300 sectors.


BUGS

     Cdrecord should verify that the input data will fit  on  the
     media. Currently you get unpredictable results in this case.

     There should be an option to write index numbers  for  audio
     tracks.

     There should be a recover option to make disks usable,  that
     have been written during a power failure.



AUTHOR

     Joerg Schilling
     Seestr. 110
     D-13353 Berlin
     Germany

     Mail bugs and suggestions to:

     joerg@schily.isdn.cs.tu-berlin.de or  js@cs.tu-berlin.de  or
     jes@fokus.gmd.de


GMD GMD Homepage GMD FOKUS FOKUS Homepage Schily Schily's Homepage VED powered