Application Support: Solaris 8: Recording CD’s on Solaris



Creating a CD is a two-step process, first a special image needs to be made of the CD contents, then that image is “burned” to a CD. In many Windows applications, this is done automagically in one step. In the UNIX world we do it in two steps since there are valid reasons to have the image around whether I make a CD of it or not.


A standard CD image is an ISO-9960 (International Standards Organization) format. In the format all filenames have 8 characters with a 3 character extension. Recently, the standard has been expanded with “Rock Ridge Extensions” which allow longer filenames to be created. With the Rock Ridge extensions, you can have file names up to 32 characters, but with some restrictions. The most annoying of the exceptions is that you can not have multiple “.”s in a file name (i.e. index.html.old is an invalid name).


A CD will only hold about 600-650MB of data. You need to know exactly how much data is involved before you get started. The easiest way to do this is to type du –s –k directory1 [directory2 …]. This will give you the amount in Kilobytes that are in each directory. This number ideally should be under 600000, since the conversion to the ISO image takes up some space. (600000KB = 600MB). If you get a result over about 620MB, you may want consider moving some of the data to another directory structure.


We have created two scripts that will allow you to write CD’s from machines equipped with CD Recorders. The first is ‘mkiso’ which will create the ISO image for you, the second is ‘mkcd’ which actually burns the CD.


The scripts lie in /usr/local/bin on the Solaris 8 systems. /usr/local/bin is in everyone’s PATH variable by default, so you should be able to type the script directly.


To begin, you need to be in a directory that has enough space for the image, since most home dirs only have 100-200MB of space, you can cd to /opt/cd which should have enough space for the image file.


The first script you will run will be ‘mkiso’. The usage is:


            mkiso [-l] directory1 [directory2 …]  (The options in [] are optional)


            where directory1 is the top level directory that you want put on CD. All data from this point down will get copied to CD.

            -l relaxes the restrictions of file names beyond those mentioned above. It may or may not create correct files.  Use at your own risk.


When you type mkisofs /local/big2/user this is the output:


            mkisofs front end v 0.4

      use –l for long names


      For the following questions you can simply hit return to use

the default values.


      Enter data preparer [GEO User] [?]


The first question asks for the data preparer (usually your name), the first [] contains the default value for the option, here it is GEO User, the second [] is just a prompt telling you to type in your response.


            Enter volume title [unTitLed Cdrom DiSc] [?]


This question asks for the title you would like to give the volume. This shows up in My Computer under Windows. It is capitalized crookedly so you know that you can use upper case and lower case.


            Enter publisher [GEO User] [?]


Enter the publisher (usually your name, or if I do it, this would be the user I am doing it for).


            Name of ISO image file [new.iso] [?]


Enter the name you want the image file to have. You will need this for the second script.


When the script starts, it runs through the data structure looking for invalid file names and files that you do not have permissions to. These errors will be written to the screen. If you want to fix the problems, hit Control-C. (Note: if you wait too long, you may have to remove the ISO image file as it may have started being written.)


After the script ends you should have a file named new.iso or whatever you named it. If you do, and you copied down any errors you get, you are ready to go to the second script and actually burn the CD.


The second script is ‘mkcd” which uses one of two programs depending on the machine. The first choice is /usr/sbin/cdrw, the second is /opt/sfw/bin/cdrecord the computer will determine which is the appropriate one to use. If you want more info, look at the man pages (man cdrecord or man cdrw).


The script mkcd does not work for audio CD’s or CDRW’s. The individual programs cdrw and cdrecord do. Look at the man pages.


The usage for mkcd is:


            mkcd  (no options)


Typing mkcd will produce the output in bold type.


            Cdrecord front end v0.4


      For the following questions you can simply hit return and the application will use

the default values.


      Dummy mode (type 1 for yes, 0 for no) [] [?]


Dummy mode is a testing mode that is used when you want to simulate a burn, but not actually turn the laser on. This is useful to make sure your data will fit on a CD and that the speed is not too high for the burner.


            Target of drive (<controller>,<target>,<slice>) [0,6,0] [?]


Note: This question will only show up if you are using the cdrecord program. This is decided automatically just skip if it does not show up.


The target is the most difficult option, generally I will try to write the correct numbers on the drive that is attached to the computer however I do not always do it. The default is 0,6,0 for single drive machines. If you have a question or problem with it, let me know. (Alternatively you can type cdrecord –scanbus which will show you the available devices. You may be able to determine which is the CDRW from this list. On the left of the output is the numbers for cdrecord). 


            Speed of drive [4] [?]


The writing speed of the drive you want to use. Generally I would run –dummy at speed 4 to make sure it work correctly, if not, drop by a power of 2, i.e. 12,8,4,2,1.


            Name of ISO image file [new.iso] [?]


The ISO file you want to use, should be the same name as the first script file.


If you use a valid filename you will get one of the following outputs:


For /opt/sfw/cdrecord


Cdrecord 1.9 (sparc-sun-solaris2.8) Copyright (C) 1995-2000 Jvrg Schilling

TOC Type: 1 = CD-ROM

scsidev: '0,6,0'

scsibus: 0 target: 6 lun: 0

Warning: Using USCSI interface.

Using libscg version 'schily-0.1'

atapi: 0

Device type    : Removable CD-ROM

Version        : 2

Response Format: 2

Capabilities   : SYNC

Vendor_info    : 'YAMAHA  '

Identifikation : 'CRW4416S        '

Revision       : '1.0f'

Device seems to be: Generic mmc CD-RW.

Using generic SCSI-3/mmc CD-R driver (mmc_cdr).

Driver flags   : SWABAUDIO

FIFO size      : 4194304 = 4096 KB

Track 01: data   14 MB       

Total size:      16 MB (01:40.86) = 7565 sectors

Lout start:      17 MB (01:42/65) = 7565 sectors

starting dummy write in 9 seconds.


If you do not use –dummy you will get :


                        starting real write in 9 seconds.


The program will then count down the seconds, then give a status about how much data it has written on what track, and finally fixate the disk. Fixating closes the CD so it can be used by a computer. If everything works fine, there will be no errors and the CD will have been created.


For /usr/bin/cdrw:


            Using SUN CDRW package

            /usr/sbin/cdrw –i  -p 4 –S new.iso

            Initializing device (Simulation)…done.

            Writing Track 1 …. 1%done

            Finalizing (can take up to 4 minutes)…done.


            If everything works fine there will be no errors and the CD will have been created.



Please remove the ISO file that you saved after you have verified that the CD works fine.


-Sys adm