Linux, the kernel, supports (mostly) either packet writing or something similar. Packet writing is a mode of writing to writable or rewritable CDs and DVDs that is incremental, that is block by block, instead of track by track, and with a lot less space overhead than .
Packet writing therefore allows one to handle CDs and DVDs that support it in part like a regular random access disc drive.
CD and DVD media fall into thre categories depending on their rewritability:
Or put another way:
The block IO subsystem of recent kernels can use rewritable
media as if they were big floppies, writing to them directly, but
this is somewhat slow; it cannot write at all to writable or
erasable media, which traditionally have been written using bulk
image writers like
for CD-R and CD-RW or
for DVD+R, DVD+RW,
DVD-R and DVD-RW.
The packet writing driver
pktcdvd is a
wrapper around a block device, and grabs the IO
requests that would have gone to the IO device and assembles
packets that are then sent to the CD
or DVD drive in packet mode.
This has two important advantages:
However, because of various mishaps, not all drives are supported by the packet writing driver. Here are lists of drives known to work with it:
For packet writing these different types of software are needed:
pktcdvddriver in the kernel
pktcdvddriver can support an old or a new API, and the new API was introduced in version 0.20 and it is important to make sure that it is available. You can check the version of the driver looking at the kernel logs for the version information it prints when the driver is initialized.
udftoolspackage. The name comes from UDF, the filesystem used most often for packet writing, but the package includes packet writing utilities that are not UDF specific.
pktcdvddriver is version 0.20 or later offering the new API, the package, if version 1.0.0b3 or earlier, must be patched as described here. Recent binary packages for
udftoolsfrom most distributions already have the patch.
Because CD and DVD media can be used in several different modes, they often need to be physically formatted for the specific use they are put to.
CD-R, DVD+R, and DVD-R media cannot be formatted, because they are write-once; the writing mode is instructed to the drive writing to them, and the packet writing driver chooses the right mode.
MO and DVD-RAM media are as a rule ready to use, having been hard-formatted during manufacturing.
CD-RW, DVD+RW, DVD-RW can be formatted in several different modes, and it is critical that they be formatted in the right mode for use in packet writing:
cdrwtoolprogram of the
udftoolspackage, for example as:
cdrwtool -d /dev/cdwriter -ior equivalently, first blanking, for example as:
cdrecord -dev ATAPI:/dev/cdwriter -blank fastand then a track has to be made:
cdrecord -dev ATAPI:/dev/cdwriter -tao - < /dev/zero
dvd+rw-format -force /dev/dvdwriterand since the mode is an overwrite mode, they have to written to first, for example with:
growisofs -Z /dev/dvdwriter=/dev/zero
In order to use the packet writing driver it must be wrapper around the ordinary CD or DVD block driver, so reads or writes to the packet driver device are reflected onto the actual CD or DVD device.
This is done using the
pktsetup utility from the
udftools package, in one of two ways:
pktcdvdversions before 0.20, one must create (or have created by automagic systems like
udev) enough devices like
/dev/pktcdvd0. This can be done for example with:
for I in 0 1 2 3; do mknod /dev/pktcdvd"$I" c 97 "$I"Once these devices are created, the wrapping can be done with
pktsetup /dev/pktcdvd0 /dev/dvdwriter
udftools(version 1.0.0b3 as of 050902) with the new API patch. With the new API the packet writing device gets created with whatever name one chooses as the first argument of
pktsetup, under the
/dev/pktcdvd/directory, for example with:
pktsetup 0 /dev/dvdwriterwhich creates
/dev/pktcddvd/0(note the slash). The
/dev/pktcdvd/directory will also contain a
controlspecial file for the use of
pktsetup, which should not be used directly.
/dev/pktcdvd/0, will then be available for reading and writing to.
Once the disc has been prepared and the packet writing deviced wrapped, it is possible to start writing to and using the disc in read or write mode.
For fully rewritable devices like MO, DVD-RAM and DVD+RW (and
DVD-RW once in packet writing mode) one can in theory format
the disc with and use any filesystem, including the classic
However because even fully rewritable discs of that type tend to have limited write cycles, or very slow rewrite, it is usually best to use a filesystem designed keeping this is mind, like UDF.
end_request: I/O errorreferring to the CD/DVD writer being used. These errors have nothing to do with packet writing, but rather with the CD/DVD writing layer.
idescsifor packet writing. You can use the IDE/ATA device name directly.