CDFS(4) CDFS(4) NAME cdfs, cddb - optical disc (CD, DVD, BD) track reader and writer file system SYNOPSIS cdfs [ -d sddev ] [ -m mtpt ] grep aux/cddb /mnt/cd/ctl | rc aux/cddb [ -DTt ] [ -s server ] [ -e dir ] query diskid ntracks track0id ... DESCRIPTION Cdfs serves a one and a half level directory mounted at mtpt (default /mnt/cd) that provides access to the tracks on discs placed in the disc reader or writer named by sddev (default /dev/sdD0, see sd(3)). Any MMC-compliant compact disc (CD), DVD, or Blu-ray disc (BD) drive should work. On DVDs and BDs, access to data tracks only is implemented. The top level directory contains one file per disc track. The files are named cNNN, where c is a type character (a for audio tracks and d for data tracks) and NNN is the track number. If the device can write discs and contains a writable disc, the top-level directory also contains an empty directory wd and, for CDs only, an empty directory wa. Files created in these directories appear in the top-level directory as new data or audio tracks, respectively, regardless of name. At any time, any number of tracks may be open for reading or a single track may be open for writing. Writing a disc track is a quasi-real-time operation: the disc writer should be kept saturated with new data to avoid buffer underruns, but modern drives will be told to cope with underruns trans- parently. To ensure saturation, copying from a file system stored on local disk or memory is recommended. To fixate a disc (close a recordable disc by writing its permanent table of contents), simply remove the wa or wd directory. The directory removed selects whether the disc is fixated as an audio or data disc; since each track car- ries its own type information, very few readers care which fixation type was used. Rewritable discs do not require fixation. The top level directory also contains a ctl file, into which control messages may be echoed. The current control mes- sages are: format Format the rewritable disc (-RW or -RE) in the CDFS(4) CDFS(4) drive before initial use. blank Blank the entire rewritable disc in the drive. quickblank Blank only the table of contents on the rewrit- able disc in the drive. eject Eject the disc in the drive. ingest Ingest a disc into the drive. speed kbps Set the reading and writing speed to use, in units of 1,000-bytes-per-second. A value of `best' requests the optimal speed for the cur- rent drive and disc. CD `1x' speed is 154; DVD `1x' speed is 1350; BD `1x' speed is 4608. Drives may round down the speed to one they sup- port. To set reading and writing speeds sepa- rately, prefix the speeds with read or write, as in speed write 8192 or speed read 16384 write 8192. Note that most drives reset the reading and writing speed each time a new disc is inserted. Reading the ctl file yields information about the drive. If the drive contains an audio CD, the first line will be an aux/cddb command that can be run to query an internet CD database to get a table of contents. Subsequent lines con- tain the current and maximum reading and writing speeds. Additional lines may further describe the current disc. Aux/cddb takes 5 optional arguments. The -s option makes aux/cddb use server for the query instead of `gnudb.org'. The -D option causes the raw database response from the server to be dumped to standard output. The -t option causes the time of each track to be appended to the normal output. -T is like -t but prints a final line with the total time. The -e option will print rc commands using audio/flacenc(1) to encode and tag audio tracks from the disc to output directory dir. EXAMPLES Backup to a BD-R disc: 9fs boot cdfs tar cf /mnt/cd/wd/x /n/boot Copy the audio tracks from a CD: cdfs -d /dev/sd05 mkdir /tmp/songs cp /mnt/cd/a* /tmp/songs Copy the tracks onto a blank CD inserted in the drive, and then fixate the disk as an audio CD. CDFS(4) CDFS(4) cp /tmp/songs/* /mnt/cd/wa rm /mnt/cd/wa SOURCE /sys/src/cmd/cdfs SEE ALSO sd(3), 9660srv (in dossrv(4)), mk9660(8) http://www.t10.org optical disc interface standards BUGS Fixating a BD-R disc records only the first track in the disc's TOC. Any other tracks are still there and their data accessible via sd(3). There's no need to fixate data discs, except to prevent adding new tracks. Closing a just-written DVD-R track can take minutes while the drive burns the unused part of the track reservation (for the whole disc). Thus only a single DVD-R track can be written on a DVD-R disc; use other media if you need more than one track per disc. There are too many combinations of optical media, each with unique quirks, approximately the cross-product of these tuples: (CD DVD- DVD+ BD), (single-layer dual-layer), (-ROM -R -RW). Only MMC-compliant disc readers and writers are supported, but it would be easy to add support for early CD writers if desired.