CD-Recordable FAQ | Sun CD-ROM FAQ
To write a CD you need to:
The software for both creating the disk image and driving a CD writer
connected to a Unix host is available at
ftp.berlios.de/pub/cdrecord/. If you're running SunOS or Solaris
you will also need the scg driver (see the scg section below).
Cdrecord used to be available as either source or binary, but last time I looked there were no binary distributions at the ftp.fokus.gmd.de site. However a binary distribution of cdrecord.1.8.24 which includes mkisofs 1.12b5 is available at the Solaris Package Archive. This site (and its mirrors) contains packages that can be easily installed with the Solaris pkgadd command. See the README file for further details.
I have compiled a binary of mkisofs suitable for Suns running Solaris 2. Right-click on the link and select Save Link As. Then chmod 755 mkisofs and copy it to a suitable directory.
The rest of this section is only applicable if you downloaded the software from the ftp.fokus.gmd.de site.
The file cdrecord-1.9.tar.gz contains the source code for both cdrecord and mkisofs. The source code for various versions of mkisofs is also available separately in the mkisofs directory of the ftp site. The latest version as of January 2001 is mkisofs-1.13.tar.gz.
Even if you plan to get the binaries from the Solaris Package Archive it is a good idea to download source so that you can peruse all the README files. In either case, you will need gzip to uncompress the files.
If you want to compile the programs from source, you will need a C compiler such as gcc and a make program. The 'make' that comes with Solaris 7 (/usr/ccs/bin/make) will do, GNU make is better, but Jörg Schilling's first preference is his smake.
Untar the source and change to the cdrecord-1.9/DEFAULTS directory. If you're using gcc, edit Defaults.sunos5, commenting the
DEFCCOM= ccline and uncommenting the
DEFCCOM= gccline. Also, if you want the executables installed somewhere other than /opt/schily, change the INS_BASE line to read (for example)
INS_BASE= /usr/localChange back to the cdrecord-1.9 directory and type make to start the compilation. If all goes well, you can then type (as root) make install.
Note that if you set INS_BASE to /usr/local as described above, it is not
necessary to edit the LDPATH line in the Defaults.sunos5 file. The library files
are correctly installed in /usr/local/lib.
The ftp site contains 2 Solaris packages...
SCHILYscg.i386.tar.Z (for Intel based computers) and
SCHILYscg.sparc.tar.Z (for Suns).
There are also numerous updates to the actual scg driver, all having filenames starting with scg. At the time of writing (October 1999, updated Feb 2001) the recommended file for Suns running a 32bit kernel is scg-sparc-sol2.4.beta. This includes all versions of Solaris prior to Solaris 7, as well as Solaris 7 and 8 running a 32bit kernel. I am presently running with scg-sparc-sol2.4.beta on Solaris 8 with a 32bit kernel.
If you are running a 64bit kernel with Solaris 7 or 8, see the note below. (You can see what kernel you are running using the isainfo -b command. It simply prints 32 or 64 for 32bit or 64bit kernels respectively).
You can ftp to ftp.fokus.gmd.de/pub/unix/kernel/scg/ and get SCHILYscg.sparc.tar.Z and scg-sparc-sol2.4.beta (make sure to use binary mode) or you can visit this site with your browser, then select the required file with your right mouse button and select "Save Link As".
A couple of important notes from the README file in the ftp site:
As described in the README file, the installation procedure for Suns is to (as root) first copy the update file to the right place, then install the package:
cp scg-sparc-sol2.4.beta /kernel/drv/scg uncompress SCHILYscg.sparc.tar.Z tar -xvf SCHILYscg.sparc.tar pkgadd -d .When asked if pkgadd should overwrite the conflicting files (i.e. the file you placed in /kernel/drv) answer with 'no'.
After you have successfully installed CDrecord and scg, connected your CD writer and turned it on, you might like to try the command (as root)
cdrecord -scanbusThis should print a line for every SCSI device on your system, including your CD writer.
So far, I have always written the whole CD in one go. See the file README.multi in the cdrecord source if you want to write multi-session CDs. Another source of information is the Multi-session CD Mini Howto.
Although the type of data is irrelevant, this section shows how I use mkisofs to make a disk image of Varian Nuclear Magnetic Resonance data. On our system the NMR data is kept in a separate partition called "fids". Users have their own data directories, so the directory structure looks like this:
/fids -+- angusfids/ dept.fid cosy.fid etc. | +- harryfids/ . . . | +- jonesfids/ . . . |and so on. To decide which data will fit onto a CD, open an Xterm, change to the /fids directory and type
74284 angusfids 64735 harryfids 39349 jonesfids 2 lornafids 192562 maryfids (and so on)Simply use the numbers on the left (the disk space in kbytes used by each directory) to decide which directories when backed up will consume about 650 Mbytes of disk space. If your requirements are more complex, perhaps because the data to be backed up is mixed up with other things, you may need to copy the required data somewhere before making the ISO file system. (Of course you need to have read permission on all the files to be backed up, which is why I normally do this as root).
CDs use the
file system. This uses the restrictive DOS-like naming convention of
"up to 8 characters, followed by a period, followed by a 3 character
extension". It also adds a semicolon and a file version number to the
filename. So for example the name
This is not very satisfactory if backing up files from a Unix system, but mkisofs allows you to create an ISO-9660 filesystem with Rock Ridge extensions, which allows long, mixed-case filenames. Version 1.13 of mkisofs has many new command-line options for such things as creating hybrid ISO9660/JOLIET/HFS filesystems. The good news is that the man page now contains some usage examples, so my advice is to type man mkisofs and skip down to the EXAMPLES section (near the end) and read this first.
The command line I use to create the ISO file system is:
cd /fids mkisofs -r -x./lornafids -x./zeusfids -o /some/disk/backup.img ./
The -r option creates the Rock Ridge extensions. It also sets each file on
the CD to be owned by root and world readable. If you want to use Rock Ridge
extensions without changing the mode or ownership of files on the CD, use
the -R option instead.
The -x options are directories to exclude, either because they are empty or contain too much data to fit on the CD.
The ./ tells it to back up the current directory.
It is also possible to "graft" other directory paths onto the top level directory on the CD. In older versions of mkisofs this is done like this...
cd /fids mkisofs -r -x./lindafids -o /some/disk/backup.img ./ /space/home/John/=/JohnIn newer versions you need to use the -graft-points option:
mkisofs -graft-points -r -x./lindafids -o /some/disk/backup.img ./ /space/home/John/=/JohnNote that it won't work without the "/" preceding the equals sign.
If none of the disks connected to the computer have enough free space to contain the disk image, pipe the image to another computer ...
cd /fids mkisofs -r -x./lindafids ./ | rsh other_host "(cd /some/disk; dd of=backup.img)"The above example uses rsh (remote shell) to transfer the disk image. It is also possible to use ssh (secure shell) if it is installed on both the source and target computer...
mkisofs -r -x./lindafids ./ | ssh fred@other_host "dd of=backup.img" Password:Here the disk image will be created in fred's home directory after he types his password on "other_host".
As stated in the cdrecord man page, if your computer is fast enough and the file system is not too complicated, you can pipe the output of mkisofs directly into cdrecord without saving an image on disk. I have not tried this because I like to check the size of the image to be sure it is not too big to fit on the CD, but I guess the command would be something like
mkisofs -r -x./lindafids ./ | cdrecord -v fs=6m speed=2 dev=5,0 -
Change to the directory containing the disk image.
I become root to issue the cdrecord commands, and depending on your setup, you might need to type the complete pathname to the cdrecord executable. Sometime I'll investigate writing CDs as a non-root user.
It is a good idea to check that your computer can supply data quickly
enough to write the CD at the required speed. You do this using the
-dummy argument. For example:
cdrecord -dummy -v speed=8 dev=5,0 backup.img
...where backup.img is the name of your disk image, and dev=5,0 tells it that the CD writer occupies SCSI address 5. Change this to reflect the SCSI address of your CD writer, eg. dev=6,0
The "dummy" command above goes through the process of writing the CD, but keeps the laser turned off. If all goes well, you are ready to write the CD. Note that some drives need to eject the medium before writing a new CD. Doing a -dummy test and immediately writing a real CD would not work on these devices. Press the eject button and then reinsert the CD. If the CD is not ejected, try
cdrecord dev=5,0 -eject
To write the CD, type something like this:
cdrecord -v speed=8 dev=5,0 backup.img
See the man page for more usage details.
The output should be similar to this...
Cdrecord 1.9 (sparc-sun-solaris2.7) Copyright (C) 1995-2000 Jörg Schilling TOC Type: 1 = CD-ROM scsidev: '5,0' scsibus: 0 target: 5 lun: 0 Using libscg version 'schily-0.1' atapi: 0 Device type : Removable CD-ROM Version : 2 Response Format: 2 Capabilities : SYNC LINKED Vendor_info : 'MATSHITA' Identifikation : 'CD-R CW-7503 ' Revision : '1.06' Device seems to be: Generic mmc CD-R. Using generic SCSI-3/mmc CD-R driver (mmc_cdr). Driver flags : SWABAUDIO Drive buf size : 2090928 = 2041 KB FIFO size : 4194304 = 4096 KB Track 01: data 650 MB Total size: 746 MB (73:57.66) = 332825 sectors Lout start: 746 MB (73:59/50) = 332825 sectors Current Secsize: 2048 ATIP info from disk: Indicated writing power: 5 Is not unrestricted Is not erasable Disk sub type: Medium Type A, low Beta category (A-) (2) ATIP start of lead in: -11839 (97:24/11) ATIP start of lead out: 336075 (74:43/00) Disk type: Long strategy type (Cyanine, AZO or similar) Manuf. index: 24 Manufacturer: SONY Corporation Blocks total: 336075 Blocks current: 336075 Blocks remaining: 3250 Starting to write CD/DVD at speed 8 in write mode for single session. Last chance to quit, starting real write in 1 seconds. Waiting for reader process to fill input buffer ... input buffer ready. Performing OPC... Starting new track at sector: 0 Track 01: Track 01: 1 of 650 MB written (fifo 100%). Track 01: Total bytes read/written: 681621504/681621504 (332823 sectors). Writing time: 571.346s Fixating... Fixating time: 39.090s cdrecord: fifo had 10737 puts and 10737 gets. cdrecord: fifo was 0 times empty and 10521 times full, min fill was 93%.
growisofs -Z /dev/dvd=backup.imgI've only done this on a Linux computer (Debian 3.1/unpatched 2.4.26 kernel) with DVD-R or DVD+R disks. It seems a version for Solaris is also available. See further notes at http://fy.chalmers.se/~appro/linux/DVD+RW/ and http://crashrecovery.org/oss-dvd/HOWTO-ossdvd.html
The sformat program can be used to check that the data was correctly written to the CD. If the CD writer is connected to target 5 on SCSI bus 0, the command to verify the CD would be: sformat -verify 5 0
NOTE: The README.verify file states that
Not all CD-ROM drives support verifying.
This is certainly the case with our CD writer, and attempting to verify the CD with sformat just produces a stream of errors...
sformat: I/O error. verify: scsi sendcmd: no error CDB: 2F 00 00 00 00 03 00 03 E5 00 status: 0x2 (CHECK CONDITION)... and other messages not listed here.
A quick check of the filesystem is to mount the CD and to use
star, (Jörg Schilling's
version of the standard Unix tar command) to read all files on the CD. Note that
this will not report errors due to truncated or zero-length files.
The same check can be performed using GNU tar or the standard tar that comes with Solaris:
cd /cdrom tar cvf /dev/null .(Don't forget the space and period after /dev/null).