Optical disc drive (简体中文)

In computing, an optical disc drive (ODD) is a disk drive that uses laser light or electromagnetic waves within or near the visible light spectrum as part of the process of reading or writing data to or from optical discs. Some drives can only read from discs, but recent drives are commonly both readers and recorders, also called burners or writers. Compact discs, DVDs, and Blu-ray discs are common types of optical media which can be read and recorded by such drives. Optical drive is the generic name; drives are usually described as "CD" "DVD", or "Blu-ray", followed by "drive", "writer", etc.

没有决定大小的话就忽略 count=$blocks。你可能会得到比需要的更多的数据。The resulting file will nevertheless be mountable. It should still fit onto a medium of the same type as the medium from which the image was copied.

如果原光盘是可启动的，那么复制后的数据也是可启动的。你可以将其作为虚拟机的伪光盘或者刻录成可启动的光盘。

擦除CD-RW和DVD-RW

用过的CD-RW介质在向之前录制的数据上写入数据之前需要先擦除之前的数据。这样：

$ cdrecord -v dev=/dev/sr0 blank=fast

blank有两个选项： blank=fast 和 blank=full。full和完全写入持续的时间一样长。It overwrites the payload data on the CD. Nevertheless this should not be considered as securely making those data unreadable. For that purpose, several full write runs with random data are advised.

Unlike DVD-RAM, DVD+RW, and BD-RE, formatted DVD-RW cannot be used as (slow) hard disk directly, but rather need the mediation of driver pktcdvd. See man pktsetup.

格式化BD-RE和BD-R

BD-RE第一次使用需要被格式化。当烧录程序检测到未格式化状态时这会自动完成。Nevertheless the size of the payload area can be influenced by expert versions of the format commands shown above for DVD-RW.

格式化或未格式化BD-R都能被使用。Unformatted they are written with full nominal speed and offer maximum storage capacity. Formatted they get checkread during write operations and bad blocks get replaced by blocks from the Spare Area. This reduces write speed to a half or less of nominal speed. The default sized Spare Area reduces the storage capacity by 768 MiB.

growisofs formats BD-R by default. The others do not. growisofs can be kept from formatting. cdrskin and xorriso can write with full nominal speed on formatted BD-RE or BD-R:

Both runs should yield the same MD5 checksum (here: e5643e18e05f5646046bb2e4236986d8). If they do not, you will probably also get an I/O error message from the dd run. dmesg might then tell about SCSI errors and block numbers, if you are interested.

ISO 9660和即时烧录

It is not necessary to store an emerging ISO file system on hard disk before writing it to optical media. Only very old CD drives at very old computers could suffer failed burns due to empty drive buffer.

If you omit option -o from mkisofs then it writes the ISO image to standard output. This can be piped into the standard input of burn programs.

这里其实不需要选项 -waiti。It prevents cdrecord from writing to the medium before mkisofs starts its output. This would allow mkisofs to read the medium without disturbing an already started burn run. See next section about multi-session.

On DVD and BD, you may let growisofs operate mkisofs for you and burn its output on-the-fly

$ growisofs -Z /dev/sr0 -V "ARCHIVE_2013_07_27" -r -J ./for_iso

Multi-session

ISO 9660 multi-session means that a medium with readable file system is still writable at its first unused block address, and that a new ISO directory tree gets written to this unused part. The new tree is accompanied by the content blocks of newly added or overwritten data files. The blocks of data files, which shall stay as in the old ISO tree, will not be written again.

Linux and many other operating systems will mount the directory tree in the last session on the medium. This youngest tree will normally show the files of the older sessions, too.

Multi-session by cdrecord

如果cdrecord的选项 -multi 被使用了，CD-R和CD-RW会保持可写（又称为“可附加”）

$ cdrecord -v -multi dev=/dev/sr0isoimage.iso

Then the medium can be inquired for the parameters of the next session

$ m=$(cdrecord dev=/dev/sr0 -msinfo)

By help of these parameters and of the readable medium in the drive you can produce the add-on ISO session

Programs cdrskin and xorrecord do this too with DVD-R, DVD+R, BD-R and unformatted DVD-RW. Program cdrecord does multi-session with at least DVD-R and DVD-RW. They all do with CD-R and CD-RW, of course.

Most re-usable media types do not record a session history that would be recognizable for a mounting kernel. But with ISO 9660 it is possible to achieve the multi-session effect even on those media.

growisofs and xorriso can do this and hide most of the complexity.

Multi-session by growisofs

By default, growisofs uses mkisofs as a backend for creating ISO images forwards most of its program arguments to . See above examples of mkisofs. It bans option -o and deprecates option -C. By default it uses the mkisofs. You may specify to use one of the others compatible backend program by setting environment variable MKISOFS:

$ export MKISOFS="xorrisofs"

The wish to begin with a new ISO file system on the optical medium is expressed by option -Z

$ growisofs -Z /dev/sr0 -V "ARCHIVE_2013_07_27" -r -J ./for_iso

The wish to append more files as new session to an existing ISO file system is expressed by option -M

$ growisofs -M /dev/sr0 -V "ARCHIVE_2013_07_28" -r -J ./more_for_iso

For details see the growisofs(1) manual and the manuals of mkisofs and xorrisofs.

Multi-session by xorriso

xorriso learns the wish to begin with a new ISO file system from the blank state of the medium. So it is appropriate to blank it if it contains data. The command -blank as_needed applies to all kinds of re-usable media and even to ISO images in data files on hard disk. It does not cause error if applied to a blank write-once medium.

BD缺陷管理

正常情况下BD-RE和已格式化的BD-R会在启用缺陷管理时写入。 This feature reads the written blocks while they are still stored in the drive buffer. In case of poor read quality the blocks get written again or redirected to the Spare Area where the data get stored in replacement blocks.

This checkreading reduces write speed to at most half of the nominal speed of drive and BD medium. Sometimes it is even worse. Heavy use of the Spare Area causes long delays during read operations. So Defect Management is not always desirable.

cdrecord does not format BD-R. It has no means to prevent Defect Management on BD-RE media, though.

growisofs formats BD-R by default. The Defect Management can be prevented by option -use-the-force-luke=spare:none. It has no means to prevent Defect Management on BD-RE media, though.

Some software only likes CUE/BIN pair, you can make a CUE sheet with toc2cue (part of cdrdao):

$ toc2cue image.tocimage.cue

Burn backend problems

If you're experiencing problems, you may ask for advise at mailing list cdwrite@other.debian.org, or try to write to the one of support mail addresses if some are listed near the end of the program's man page.

Tell the command lines you tried, the medium type (e.g. CD-R, DVD+RW, ...), and the symptoms of failure (program messages, disappointed user expectation, ...). You will possibly get asked to obtain the newest release or development version of the affected program and to make test runs. But the answer might as well be, that your drive dislikes the particular medium.

dvdbackup — Tool for pure data extraction which does not transcode. It is useful for creating exact copies of encrypted DVDs in conjunction with libdvdcss or for decrypting video for other utilities unable to read encrypted DVDs.

FFmpeg — Complete and free Internet live audio and video broadcasting solution for Linux/Unix, capable to do a direct rip in any format (audio/video) from a DVD-Video ISO image, just select the input as the ISO image and proceed with the desired options. It also allows to downmixing, shrinking, spliting, selecting streams among other features.

Hybrid — Multi platform Qt based frontend for a bunch of other tools which can convert nearly every input to x264/Xvid/VP8 + ac3/ogg/mp3/aac/flac inside an mp4/m2ts/mkv/webm/mov/avi container, a Blu-ray or an AVCHD structure.

MEncoder — Free command line video decoding, encoding and filtering tool released under the GNU GPL. It is a close sibling to MPlayer and can convert all the formats that MPlayer understands into a variety of compressed and uncompressed formats using different codecs. Wrapper programs like h264encAUR and undvdAUR[broken link: archived in aur-mirror] can provide an assistive interface. Many GUI frontends are available.

DVD设备噪音大

Playback does not work with new computer (new DVD-Drive)

If playback does not work and you have a new computer (new DVD-Drive) the reason might be that the region code is not set. You can read and set the region code with the regionsetAUR package.

None of the above programs are able to rip/encode a DVD to my hard disk!

Make sure the region of your DVD reader is set correctly; otherwise, you will get loads of inexplicable CSS-related errors. Use the regionsetAUR package to do so.

GUI program log indicates problems with backend program

If you use a GUI program and experience problems which the program's log blames on some backend program, then try to reproduce the problem by the logged backend program arguments.
Whether you succeed with reproducing or not, you may report the logged lines and your own findings to the places mentioned in #Burn backend problems section.

Special case: medium error / write error

Here are some typical messages about the drive disliking the medium. This can only be solved by using a different drive or a different medium. A different program will hardly help.

This happened at the 25GB boundary when starting to write the second layer. Using cdrecord from cdrtools works with no problems. Tested with a 'HL-DT-ST BD-RE WH16NS40' LG burner, and Verbatim BD-R DL 6x discs (#96911). FS#47797

Disc tray autocloses

If after ejecting a cd, either by using the eject command, or pushing the drive button, the drive disc tray autocloses before being able to remove the disc, try the following command:

# sysctl -w dev.cdrom.autoclose=0

如果问题解决，使改动永久生效：

/etc/sysctl.d/60-cdrom-autoclose.conf

dev.cdrom.autoclose = 0

另请参阅

在美国，backup of physically obtained media is allowed under these conditions: About Piracy - RIAA.