Previous Section  < Day Day Up >  Next Section

Recipe 11.8. Recording a Multisession Data CD

11.8.1 Problem

You want to add data files to a disc over time, rather than all at once. cdrecord closes and fixates discs, so that no additional files can be added. How do you get around this?

11.8.2 Solution

This is a two-step process. Both cdrecord and mkisofs have special options for creating multisession discs. The first time you write files to a CD, create an .iso in the usual manner, then use the -multi switch in cdrecord:

$ cdrecord -v -eject dev=0,1,0 -multi first-image.iso

Then create additional .iso images using the -C and -M options:

$ mkisofs -o second-image.iso -J -r -V Session2 -C `cdrecord dev=0,1,0 -msinfo` \

-M 0,1,0 /path-to-new-files

Then write the new .iso to disc, using the -multi option again:

$ cdrecord -v -eject dev=0,1,0 -multi  second-image.iso

Do this as many times as you like. When you get to the last session, omit the -multi option. It's important to close and fixate the disc, or it won't be readable in most drives. Another way to close and fixate the disc, without recording an additional session, is with the fix option:

$ cdrecord -v -fix  -eject dev=0,1,0

11.8.3 Discussion

CDs are written in sessions. Each session covers a number of disc sectors. On a single-session disc, there is a lead-in, a single TOC, the data, and a lead-out, which finalizes the disc and prevents further recording on the disc. mkisofs links multiple sessions together on a multisession disc. To do this, it needs to know the starting and ending sector numbers of each session. Let's take it a piece at a time:

$ mkisofs -o second-image.iso -J -r  -C `cdrecord dev=0,1,0 -msinfo` \

-M 0,1,0 /path-to-new-files


-o second-image.iso

Give the new .iso you are building a name; call it anything you want.


-J

Use Joliet naming conventions, for Windows compatibility. This is optional.


-r

Use Rock Ridge naming conventions for Unix/Linux compatibility, and make all files publicly readable. This is required for creating multisession discs.


-C `cdrecord dev=0,1,0 -msinfo`

The -C flag goes by several names: CD+, CDExtra, last_sess_start, next_sess_start. It tells mkisofs the ending point of the last session and the starting point of the next session. The backticks tell the shell to find and use the values automatically. You can generate these values manually, and see for yourself:

$ cdrecord dev=0,1,0 -msinfo

12968,20172


-M 0,1,0

The -M flag must be used when you use the -C flag. This is the SCSI bus address of the CD writer.


/path-to-new-files

List here the files, or directory, that are going into the new .iso.

11.8.4 See Also

  • cdrecord(1), mkisofs(8)

    Previous Section  < Day Day Up >  Next Section