Difference between revisions of "Optical disc drive"

From ArchWiki
Jump to: navigation, search
(Moved first section from "CD burning" page (chapter 1) into this page, no writing changes.)
m (small changes in syntax and templates. Changed the first title.)
Line 17: Line 17:
 
:''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.''
 
:''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.''
  
== Command-line CD-burning ==
+
== CD-burning ==
 
   
 
   
 
=== Install CD-burning utilities ===
 
=== Install CD-burning utilities ===
Line 27: Line 27:
 
The {{Pkg|cdrkit}} package is available in the [[official repositories]].
 
The {{Pkg|cdrkit}} package is available in the [[official repositories]].
  
If you intend to use {{Pkg|cdrdao}} (for writing {{ic|cue}}/{{ic|bin}} files to CD), install that package instead.
+
For writing {{ic|cue}}/{{ic|bin}} files to CD, install the {{Pkg|cdrdao}} package.
  
 
{{Note|
 
{{Note|
Line 38: Line 38:
 
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/cdrw}}. If that is not the case, modify the commands accordingly. In order to write to the CD it needs to be unmounted. If it is not, {{ic|wodim}} will give you an error message.
 
For the remainder of this section the name of your recording device is assumed to be {{ic|/dev/cdrw}}. If that is not the case, modify the commands accordingly. In order to write to the CD it needs to be unmounted. If it is not, {{ic|wodim}} will give you an error message.
  
If wodim gives you an error message similar to {{ic|Cannot open SCSI driver!}}, use the following command:
+
If ''wodim'' gives you an error message similar to {{ic|Cannot open SCSI driver!}}, use the following command:
 +
 
 
  $ modprobe sr_mod
 
  $ modprobe sr_mod
  
You can try to let wodim locate your burning device with this command:
+
You can try to let ''wodim'' locate your burning device with this command:
 +
 
 
  $ wodim -checkdrive
 
  $ wodim -checkdrive
  
Line 47: Line 49:
  
 
CD-RW media usually need to be erased before you can write new data on it. To blank CD-RW medium use this command:
 
CD-RW media usually need to be erased before you can write new data on it. To blank CD-RW medium use this command:
 +
 
  $ wodim -v dev=/dev/cdrw -blank=fast
 
  $ wodim -v dev=/dev/cdrw -blank=fast
  
Line 65: Line 68:
  
 
To burn an ISO image run:
 
To burn an ISO image run:
 +
 
  $ cdrecord -v dev=/dev/sr0 isoimage.iso
 
  $ cdrecord -v dev=/dev/sr0 isoimage.iso
  
Line 108: Line 112:
 
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc.
 
Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as {{ic|01.wav}}, {{ic|02.wav}}, {{ic|03.wav}}, etc.
 
Use the following command to simulate burning the wav files as an audio CD:
 
Use the following command to simulate burning the wav files as an audio CD:
 +
 
  $ wodim -dummy -v -pad speed=1 dev=/dev/cdrw -dao -swab *.wav
 
  $ wodim -dummy -v -pad speed=1 dev=/dev/cdrw -dao -swab *.wav
 +
 
In case you detect errors or empty tracks like:
 
In case you detect errors or empty tracks like:
 +
 
  Track 01: audio    0 MB (00:00.00) no preemp pad
 
  Track 01: audio    0 MB (00:00.00) no preemp pad
 +
 
try another decoder (e.g. mpg123) or try using cdrecord from the {{Pkg|cdrtools}} package.
 
try another decoder (e.g. mpg123) or try using cdrecord from the {{Pkg|cdrtools}} package.
Note that {{Pkg|cdrkit}} also contains a cdrecord command but it is just a softlink to wodim.
+
 
 +
Note that {{Pkg|cdrkit}} also contains a cdrecord command but it is just a softlink to ''wodim''.
 
If anything worked you can remove the dummy flag to really burn the CD
 
If anything worked you can remove the dummy flag to really burn the CD
  
 
To test the new audio CD, use [[MPlayer]]:
 
To test the new audio CD, use [[MPlayer]]:
 +
 
  $ mplayer cdda://
 
  $ mplayer cdda://
  
Line 121: Line 131:
  
 
To burn a bin/cue image run:
 
To burn a bin/cue image run:
 +
 
  $ cdrdao write --device /dev/cdrw image.cue
 
  $ cdrdao write --device /dev/cdrw image.cue
  
Line 126: Line 137:
  
 
To copy an existing CD just type:
 
To copy an existing CD just type:
 +
 
  $ readom -v dev=/dev/cdrw f=isoimage.iso
 
  $ readom -v dev=/dev/cdrw f=isoimage.iso
  
Line 133: Line 145:
  
 
You do not want to use dd or cat as they provide no error checking, but for reference here are those commands:
 
You do not want to use dd or cat as they provide no error checking, but for reference here are those commands:
 +
 
  $ dd if=/dev/cdrw of=/home/user/isoimage.iso
 
  $ dd if=/dev/cdrw of=/home/user/isoimage.iso
 +
 
or with cat:
 
or with cat:
 +
 
  $ cat /dev/cdrw > isoimage.iso
 
  $ cat /dev/cdrw > isoimage.iso
  
 
Or use the {{ic|readcd}} program (which is now a symlink to readom), also in the {{ic|cdrkit}} package:
 
Or use the {{ic|readcd}} program (which is now a symlink to readom), also in the {{ic|cdrkit}} package:
 +
 
  $ readcd -v dev=/dev/cdrw -f isoimage.iso
 
  $ readcd -v dev=/dev/cdrw -f isoimage.iso
  
Line 145: Line 161:
  
 
ISO images only store a single data track. If you want to create an image of a mixed-mode disk (data track with multiple audio tracks) then you need to make a TOC/BIN pair:
 
ISO images only store a single data track. If you want to create an image of a mixed-mode disk (data track with multiple audio tracks) then you need to make a TOC/BIN pair:
 +
 
  $ cdrdao read-cd --read-raw --datafile IMAGE.bin --driver generic-mmc:0x20000 --device /dev/cdrom IMAGE.toc
 
  $ cdrdao read-cd --read-raw --datafile IMAGE.bin --driver generic-mmc:0x20000 --device /dev/cdrom IMAGE.toc
  
 
Some software only likes CUE/BIN pair, you can make a CUE sheet with {{ic|toc2cue}} (part of {{ic|cdrdao}}):
 
Some software only likes CUE/BIN pair, you can make a CUE sheet with {{ic|toc2cue}} (part of {{ic|cdrdao}}):
 +
 
  $ toc2cue IMAGE.toc IMAGE.cue
 
  $ toc2cue IMAGE.toc IMAGE.cue
  
Line 153: Line 171:
  
 
To make an iso image just copy the needed files to one folder, then do:
 
To make an iso image just copy the needed files to one folder, then do:
 +
 
  $ mkisofs -V volume_name -J -r -o isoimage.iso ~/folder
 
  $ mkisofs -V volume_name -J -r -o isoimage.iso ~/folder
  
Line 158: Line 177:
  
 
To test if the ISO image is proper, you can mount it (as root):
 
To test if the ISO image is proper, you can mount it (as root):
 +
 
  # mount -t iso9660 -o ro,loop=/dev/loop0 cd_image /cdrom
 
  # mount -t iso9660 -o ro,loop=/dev/loop0 cd_image /cdrom
  
 
You have to first load the loop module:
 
You have to first load the loop module:
 +
 
  # modprobe loop
 
  # modprobe loop
  
Line 168: Line 189:
  
 
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:
 
To convert an {{ic|img}}/{{ic|ccd}} image, you can use {{Pkg|ccd2iso}}:
 +
 
  $ ccd2iso ~/image.img ~/image.iso
 
  $ ccd2iso ~/image.img ~/image.iso

Revision as of 14:06, 22 July 2013

Template:Article summary start Template:Article summary text Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary heading Template:Article summary wiki Template:Article summary wiki Template:Article summary wiki Template:Article summary end

From wikipedia

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.

CD-burning

Install CD-burning utilities

From http://www.cdrkit.org/:

cdrkit is a suite of programs for recording CDs and DVDs, blanking CD-RW media, creating ISO-9660 filesystem images, extracting audio CD data, and more. The programs included in the cdrkit package were originally derived from several sources, most notably mkisofs by Eric Youngdale and others, cdda2wav by Heiko Eissfeldt, and cdrecord by Jörg Schilling. However, cdrkit is not affiliated with any of these authors; it is now an independent project.

The cdrkit package is available in the official repositories.

For writing cue/bin files to CD, install the cdrdao package.

Note:
  • If you face any issues with cdrkit, it is recommended to install cdrtools from the community repository (cdrkit is a fork of cdrtools). cdrtools is being actively developed and supports CD, DVD and Blu-ray burning along with complete CDRWIN cue/bin support. cdrtools does not depend on cdrdao. For more information, see this page from the cdrtools site
  • Make sure that you build a package using makepkg and install with pacman. Pacman wrappers may resolve to cdrkit instead

Modifying the CD-RW

For the remainder of this section the name of your recording device is assumed to be /dev/cdrw. If that is not the case, modify the commands accordingly. In order to write to the CD it needs to be unmounted. If it is not, wodim will give you an error message.

If wodim gives you an error message similar to Cannot open SCSI driver!, use the following command:

$ modprobe sr_mod

You can try to let wodim locate your burning device with this command:

$ wodim -checkdrive

Erasing CD-RW

CD-RW media usually need to be erased before you can write new data on it. To blank CD-RW medium use this command:

$ wodim -v dev=/dev/cdrw -blank=fast

As you might have guessed, this blanks your medium really fast, but you can also use some other options, just replace the word fast with one of the following:

all
blank the entire disk
disc
blank the entire disk
disk
blank the entire disk
fast
minimally blank the entire disk (PMA, TOC, pregap)
minimal
minimally blank the entire disk (PMA, TOC, pregap)
track
blank a track
unreserve
unreserve a track
trtail
blank a track tail
unclose
unclose last session
session
blank last session

Burning an ISO image

To burn an ISO image run:

$ cdrecord -v dev=/dev/sr0 isoimage.iso

Verify the burnt ISO image

You can verify the integrity of the burnt CD to make sure it contains no errors. Always eject the CD and reinsert it before verifying.

First calculate the md5sum of the original ISO image:

$ md5sum isoimage.iso
 e5643e18e05f5646046bb2e4236986d8 isoimage.iso

If the CD was burnt in DAO (Disc At Once) mode by passing the -dao option to cdrecord you can calculate the md5sum of the burnt CD as follows:

$ md5sum /dev/sr0
 e5643e18e05f5646046bb2e4236986d8 /dev/sr0

If the CD was burnt in TAO (Track At Once) mode it can be verified with dd and md5sum. You need to know the number of sectors to check. You can calculate this by dividing the size of the ISO file by 2048, but for your convenience this is included in the output of cdrecord:

Track 01: Total bytes read/written: 90095616/90095616 (43992 sectors).

Then check if this matches the md5sum of the burnt image, replacing "count" with the number of sectors:

$ dd if=/dev/sr0 bs=2048 count=43992 | md5sum
 43992+0 records in
 43992+0 records out
 90095616 bytes (90 MB) copied, 0.359539 s, 251 MB/s
 e5643e18e05f5646046bb2e4236986d8  -

Burning an audio CD

Create your audio tracks and store them as uncompressed, 16-bit stereo WAV files. To convert MP3 to WAV, ensure lame is installed, cd to the directoy with your MP3 files, and run:

$ for i in *.mp3; do lame --decode "$i" "$(basename "$i" .mp3)".wav; done

In case you get an error when trying to burn WAV files converted with lame try decoding with mpg123:

$ for i in *.mp3; do mpg123 --rate 44100 --stereo --buffer 3072 --resync -w $(basename $i .mp3).wav $i; done

Name the audio files in a manner that will cause them to be listed in the desired track order when listed alphabetically, such as 01.wav, 02.wav, 03.wav, etc. Use the following command to simulate burning the wav files as an audio CD:

$ wodim -dummy -v -pad speed=1 dev=/dev/cdrw -dao -swab *.wav

In case you detect errors or empty tracks like:

Track 01: audio    0 MB (00:00.00) no preemp pad

try another decoder (e.g. mpg123) or try using cdrecord from the cdrtools package.

Note that cdrkit also contains a cdrecord command but it is just a softlink to wodim. If anything worked you can remove the dummy flag to really burn the CD

To test the new audio CD, use MPlayer:

$ mplayer cdda://

Burning a bin/cue

To burn a bin/cue image run:

$ cdrdao write --device /dev/cdrw image.cue

Making an ISO image from an existing CD

To copy an existing CD just type:

$ readom -v dev=/dev/cdrw f=isoimage.iso
Note: If you get "Error trying to open /dev/cdrw exclusively (Device or resource busy)...", unmount the CD with
# umount /dev/cdrw
Replace /dev/cdrw with /dev/cdrom if it's a CDRom.

You do not want to use dd or cat as they provide no error checking, but for reference here are those commands:

$ dd if=/dev/cdrw of=/home/user/isoimage.iso

or with cat:

$ cat /dev/cdrw > isoimage.iso

Or use the readcd program (which is now a symlink to readom), also in the cdrkit package:

$ readcd -v dev=/dev/cdrw -f isoimage.iso

If the original CD was bootable it will be a bootable image.

TOC/CUE/BIN for mixed-mode disks

ISO images only store a single data track. If you want to create an image of a mixed-mode disk (data track with multiple audio tracks) then you need to make a TOC/BIN pair:

$ cdrdao read-cd --read-raw --datafile IMAGE.bin --driver generic-mmc:0x20000 --device /dev/cdrom IMAGE.toc

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

$ toc2cue IMAGE.toc IMAGE.cue

Making an ISO image from existing files on hard disk

To make an iso image just copy the needed files to one folder, then do:

$ mkisofs -V volume_name -J -r -o isoimage.iso ~/folder

Mounting an ISO image

To test if the ISO image is proper, you can mount it (as root):

# mount -t iso9660 -o ro,loop=/dev/loop0 cd_image /cdrom

You have to first load the loop module:

# modprobe loop

See also Mounting images as user for doing this without root privileges.

Converting to an ISO image

To convert an img/ccd image, you can use ccd2iso:

$ ccd2iso ~/image.img ~/image.iso