understanding "-dao", "-sao", "-tao" and "-raw" writing modes for wodim in practice

18,103

The CD-DA, CD-ROM, CD-R and CD-RW formats all store information in 2,352 byte sectors, divided into 98 distinct 24-byte frames. On CD-DA discs, each 24-byte frame holds two 16-byte audio samples, one for each stereo channel. The CD-ROM specification defines two sector modes, Mode 1 and Mode 2, which describe two different sector layouts. Both modes reserve the first 16 bytes for header information. Mode 1 uses an additional 288 bytes for error detection (32-bit CRC) and correction (276-byte RSPC).

 ------------------------------------------------------------------------------------------------------------------------
| Format        |                                           2,352-byte sector                                            |
|------------------------------------------------------------------------------------------------------------------------|
| CD-DA         | 24-byte data frame (1) | 24-byte data frame (2) |            . . .           | 24-byte data frame (98) |
| -----------------------------------------------------------------------------------------------------------------------|
| CD-ROM Mode 1 | 12-byte sync pattern | 3-byte address | 2,048-byte data | 4-byte CRC | 8-byte reserved | 276-byte RSPC |
| -----------------------------------------------------------------------------------------------------------------------|
| CD-ROM Mode 2 | 12-byte sync pattern | 3-byte address |                        2,336-byte data                         |
 ------------------------------------------------------------------------------------------------------------------------

Sessions

The notion of sessions was added to the CD format specifications simultaniously with the specifications for the CD-R and CD-RW formats.

Each session consists of three areas that mimic the original structure of CD-DAs and CD-ROMs: the lead-in area contains the sessions Table Of Contents (TOC); the program area holds the individual tracks; the lead-out area marks the end of the session. Although the notion of sessions did not exist at the time the original CD-DA and CD-ROM specifications were written, these older formats consist of what essentially amounts to a single session per disc.

Some disc formats, such as CD-Rs and CD-RWs support multiple sessions per disc. Each session contains one or more tracks. In multi-session discs the TOC in the lead-in area of subsequent sessions includes the addresses of earlier sessions. The TOC in the lead-in area of the latest session is used to access the tracks on the disc.

The ISO 9660 Compact Disc File System (CDFS) standard records an index of files present on a disc in a series of volume descriptors that are stored at a fixed offset from the start of the disc. In contrast, multi-session discs store the volume descriptors at a fixed offset in the latest session. When files are added to a multi-session data disc, an updated copy of the entire directory tree is stored as part of the new session. Files can be "deleted" by removing the reference to the file from the latest session. However, as the actual file data is never altered, "deleted" files can be accessed via the directory tree from a previous session.

Writing Modes

There are several recording modes, including the ones explicitly mentioned in the question:

  • Track-At-Once

    CD content is subdivided into consecutive sets of sectors known as tracks. In Track-At-Once (TAO) mode the laser stopped and restarted between each track. This delay causes transitional areas, known as pre-gaps between the tracks. These cannot be avoided, but recorders which support Variable-Gap Track-At-Once can adjust the size of the pre-gap to a minimum of 2 sectors (2/75 of a second).

    With most drives TAO mode is required for multi-session recording.

  • Disc-At-Once

    In Disc-At-Once (DAO) mode disc contents are recorded in a single pass without stopping the laser. This allows data to be written to the the pre-gap areas to avoid them altogether.

  • Session-At-Once

    In Session at Once (SAO) mode multiple sessions can be recorded and finalized on a single disc. The resulting disc can be read by computer drives, but sessions after the first are generally not readable by CD Audio equipment.

    In Wodim, the DAO and SAO modes are synonymous. While most drives require multi-session discs to be authored in TAO mode, Wodim also has support for creating multi-session discs in SAO mode, assuming the underlying disc drive supports this.

  • Raw Mode

    Disc images of CD-ROMs can be created either in raw mode (extracting 2,352 bytes per sector independent of the sector mode) or by obtaining only the actual data in the sector (2,048/2,336/2,352/2,324 bytes depending on the sector mode).The file size of raw mode disc images is always a multiple of 2,352 bytes. When such disc images are written to an optical media in raw mode, the 2,352 byte sectors, which already include the synchronization pattern and possibly error detection and correction data, are written to the disc as they are.

  • Packet Writing

    Incremental Packer Writing (IPW) allows optical discs to be used in a manner similar to a writable block devices, i.e. it allows files to be created, modified or deleted on demand. This is achieved by writing a series of short (32k-256k) tracks on the disk in packet mode. CD-R/RW discs can be formatted into such packets, and the kernel pktcdvd module (packet writing driver) buffers up writes to the disk and transparently handles erasing and rewriting a whole packet at a time.

    Wodim has experimental support for packet writing.

Share:
18,103

Related videos on Youtube

comeback4you
Author by

comeback4you

Updated on September 18, 2022

Comments

  • comeback4you
    comeback4you almost 2 years

    In wodim one can choose between many different writing modes like Disk At Once("-dao"), Session At Once("-sao"), Track At Once("-tao") or Raw writing mode("-raw"). As I understand, Track At Once writes one track at time while in SAO and DAO modes laser does not stop between tracks. Is this important only in case of audio CD's and there is no difference in case of data CD's(for example burning Linux distribution image)? In addition, even in case of audio CD's and TAO mode, how does wodim know where one track starts or ends? Am I correct that SAO mode allows one to write multiple times to a CD-R media? Last but not least, in which case is raw writing mode useful?

  • Thomas Nyman
    Thomas Nyman almost 11 years
    It's worth noting that the description of sector layout glosses over some details such as the subtrack index, subchannels and CIRC encoding in favor of brevity.
  • psusi
    psusi almost 11 years
    Good answer but a few points: 1) you use bit in a few places where I think you meant byte. 2) Packet mode doesn't remap anything, it just writes a series of short ( 32-256k ) tracks. cdrw discs can be formatted into such packets, and you can use the kernel pktcdvd driver to buffer up writes to the disk and transparently handle erasing and rewriting a whole packet at a time, allowing you to format and mount a regular filesystem on the disc and use it like a giant floppy.
  • psusi
    psusi almost 11 years
    Finally, it is worth noting that the CDDA "sectors" are an abstraction created by the drive and don't actually exist on the disc, which caused problems early on with properly extracting audio tracks since when the laser stopped reading, seeking to the next "sector" to resume could not be done exactly.
  • Thomas Nyman
    Thomas Nyman almost 11 years
    @psusi Thanks for the comments. I fixed the bits/bytes errors and added your notes to the section on packet writing.