glenda.party
term% ls -F
term% cat index.txt
CDFS(4)                    Kernel Interfaces Manual                    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 ] 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, re‐
       gardless 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 transparently.  To ensure saturation,  copying  from  a  file
       system stored on local disk or memory is recommended.

       BD-R  discs are ‘formatted' upon first use, for sequential writing with
       spare sectors for hardware defect management, so BD drives  should  not
       report  errors  when  writing BD-R discs; any such errors may be a sign
       that the laser of an old drive is fading.

       To fixate a disc (close a recordable disc by writing its permanent  ta‐
       ble  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  carries  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 messages are:

       format Format the rewritable disc (-RW or -RE) in the drive before ini‐
              tial use.

       blank  Blank the entire rewritable disc in the drive.

       quickblank
              Blank only the table of contents on the rewritable 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 requests the  optimal  speed
              for  the  current drive and disc.  CD speed is 154; DVD speed is
              1350; BD speed is 4608.  Drives may round down the speed to  one
              they  support.   To  set  reading and writing speeds separately,
              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 contain the current and maximum  reading  and  writing
       speeds.  Additional lines may further describe the current disc.

       Aux/cddb  takes 4 optional arguments.  The -s option makes aux/cddb use
       server for the query instead of The -D option causes the  raw  database
       response  from  the server to be dumped to standard output.  The -t op‐
       tion 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.

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.

              cp /tmp/songs/* /mnt/cd/wa
              rm /mnt/cd/wa

SOURCE
       /sys/src/cmd/cdfs

SEE ALSO
       pump(1), sd(3), 9660srv (in dossrv(4)), mk9660(8)
       http://www.t10.org
              optical  disc  interface standards, notably Multi-Media Commands
              (MMC)

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), (-ROM -R -RW), (single-layer dual-layer), plus oddities like  DVD-
       RAM.   Triple-  and  quad-layer BD drives and discs are starting to ap‐
       pear.

       Only MMC-compliant disc readers and writers are supported, but it would
       be easy to add support for early CD writers if desired.

       Cdfs can take some seconds to figure out that it has a BD in the  drive
       and how many layers are on the disc.

                                                                       CDFS(4)