cdfs, cddb – optical disc (CD, DVD, BD) track reader and writer file system
grep aux/cddb /mnt/cd/ctl | rc
serves a one and a half level directory
that provides access to the tracks
on discs placed in the disc reader or writer
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
is a type character
for audio tracks
for data tracks)
is the track number.
If the device can write discs
and contains a writable disc, the top-level
directory also contains an empty directory
and, for CDs only,
an empty directory
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 transparently.
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
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
file, into which control messages
may be echoed.
The current control messages are:
Format the rewritable disc (\c
in the drive
before initial use.
Blank the entire rewritable disc in the drive.
Blank only the table of contents on the rewritable
disc in the drive.
Eject the disc in the drive.
Ingest a disc into the drive.
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.
speed is 154;
speed is 1350;
speed is 4608.
Drives may round down the speed to one they support.
To set reading and writing speeds separately,
prefix the speeds with
Note that most drives reset the reading and writing speed
each time a new disc is inserted.
file yields information about the drive.
If the drive contains an audio CD, the first line
will be an
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.
takes 4 optional arguments.
for the query instead of
option causes the raw database response from the server to be dumped
to standard output.
option causes the time of each track to be appended to the normal output.
but prints a final line with the total time.
Backup to a BD-R disc:
tar cf /mnt/cd/wd/x /n/boot
Copy the audio tracks from a CD:
cdfs -d /dev/sd05
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
optical disc interface standards
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
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,
the cross-product of these tuples:
(CD DVD- DVD+ BD),
(-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.