Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
CD imaging notes + sample tool output (scroll down for notes)
cdparanoia -B -L
cdparanoia III release 10.2 (September 11, 2008)
Ripping from sector 0 (track 1 [0:00.00])
to sector 152169 (track 17 [2:40.35])
outputting to track01.cdda.wav
outputting to track02.cdda.wav
outputting to track03.cdda.wav
outputting to track04.cdda.wav
outputting to track05.cdda.wav
outputting to track06.cdda.wav
outputting to track07.cdda.wav
outputting to track08.cdda.wav
outputting to track09.cdda.wav
outputting to track10.cdda.wav
outputting to track11.cdda.wav
outputting to track12.cdda.wav
outputting to track13.cdda.wav
outputting to track14.cdda.wav
outputting to track15.cdda.wav
outputting to track16.cdda.wav
outputting to track17.cdda.wav
Done.
cdparanoia -B -l
cdparanoia III release 10.2 (September 11, 2008)
Using cdda library version: 10.2
Using paranoia library version: 10.2
outputting to track01.cdda.wav
(== PROGRESS == [ | 009802 00 ] == :^D * ==)
outputting to track02.cdda.wav
(== PROGRESS == [ | 020133 00 ] == :^D * ==)
outputting to track03.cdda.wav
(== PROGRESS == [ | 026316 00 ] == :^D * ==)
outputting to track04.cdda.wav
(== PROGRESS == [ | 033059 00 ] == :^D * ==)
outputting to track05.cdda.wav
(== PROGRESS == [ | 045133 00 ] == :^D * ==)
outputting to track06.cdda.wav
(== PROGRESS == [ | 050784 00 ] == :^D * ==)
outputting to track07.cdda.wav
(== PROGRESS == [ | 061780 00 ] == :^D * ==)
outputting to track08.cdda.wav
(== PROGRESS == [ | 070817 00 ] == :^D * ==)
outputting to track09.cdda.wav
(== PROGRESS == [ | 080006 00 ] == :^D * ==)
outputting to track10.cdda.wav
(== PROGRESS == [ | 091292 00 ] == :^D * ==)
outputting to track11.cdda.wav
(== PROGRESS == [ | 097467 00 ] == :^D * ==)
outputting to track12.cdda.wav
(== PROGRESS == [ | 102271 00 ] == :^D * ==)
outputting to track13.cdda.wav
(== PROGRESS == [ | 107527 00 ] == :^D * ==)
outputting to track14.cdda.wav
(== PROGRESS == [ | 110113 00 ] == :^D * ==)
outputting to track15.cdda.wav
(== PROGRESS == [ | 125726 00 ] == :^D * ==)
outputting to track16.cdda.wav
(== PROGRESS == [ | 140133 00 ] == :^D * ==)
outputting to track17.cdda.wav
(== PROGRESS == [ | 152169 00 ] == :^D * ==)
CD-RW : no
Total Capacity : n/a
CD-R medium : n/a
Recording Speed : n/a
CD-R empty : no
Toc Type : CD-DA or CD-ROM
Sessions : 2
Last Track : 18
Appendable : no
# Rescue Logfile. Created by GNU ddrescue version 1.17
# Command line: ddrescue -b 2048 -r4 -v /dev/sr0 gordi_virussen.iso gordi_virussen.log
# current_pos current_status
0x01330000 ?
# pos size status
0x00000000 0x01330000 +
0x01330000 0x00010000 *
0x01340000 0x24878000 ?
# Rescue Logfile. Created by GNU ddrescue version 1.17
# Command line: ddrescue -b 2048 -r4 -v /dev/sr0 REBELS_0.iso REBELS_0.log
# current_pos current_status
0x28AF0000 +
# pos size status
0x00000000 0x28AFA800 +
CD-ROM is in ISO 9660 format
System id:
Volume id: REBELS_0
Volume set id:
Publisher id:
Data preparer id:
Application id: NERO - BURNING ROM
Copyright File id:
Abstract File id:
Bibliographic File id:
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 333151
Joliet with UCS level 3 found
NO Rock Ridge present
/AUTORUN.EXE;1
/AUTORUN.INF;1
/DISK0
/LICENSE2.TXT;1
/LICENSEF.TXT;1
/LICENSEG.TXT;1
/LICENSEI.TXT;1
/LICENSEN.TXT;1
/LICENSEU.TXT;1
/SETUP.EXE;1
/DISK0/CONTROLS.CFG;1
/DISK0/DISK0;1
/DISK0/DONUT.CFG;1
/DISK0/READMEFR.TXT;1
/DISK0/READMEGE.TXT;1
/DISK0/READMEIT.TXT;1
/DISK0/READMENL.TXT;1
/DISK0/READMESP.TXT;1
/DISK0/READMEUK.TXT;1
/DISK0/REBELS.CFG;1
/DISK0/REBELS.EXE;1
/DISK0/REBELS64.ICO;1
/DISK0/REBELS_D
/DISK0/SAVEGAME
/DISK0/REBELS_D/ARCTIC
/DISK0/REBELS_D/CITY
/DISK0/REBELS_D/COMMON
/DISK0/REBELS_D/HOSPITAL
/DISK0/REBELS_D/LEVELS.CFG;1
/DISK0/REBELS_D/REBELS_T.EXE;1
/DISK0/REBELS_D/TWEAK.CFG;1
/DISK0/REBELS_D/ARCTIC/DATA.PAK;1
/DISK0/REBELS_D/ARCTIC/DNT.PAK;1
/DISK0/REBELS_D/ARCTIC/FKA.PAK;1
/DISK0/REBELS_D/ARCTIC/GUI.PAK;1
/DISK0/REBELS_D/ARCTIC/PF.PAK;1
/DISK0/REBELS_D/ARCTIC/SHADOW.PAK;1
/DISK0/REBELS_D/ARCTIC/SND.PAK;1
/DISK0/REBELS_D/CITY/DATA.PAK;1
/DISK0/REBELS_D/CITY/DNT.PAK;1
/DISK0/REBELS_D/CITY/FKA.PAK;1
/DISK0/REBELS_D/CITY/GUI.PAK;1
/DISK0/REBELS_D/CITY/PF.PAK;1
/DISK0/REBELS_D/CITY/SHADOW.PAK;1
/DISK0/REBELS_D/CITY/SND.PAK;1
/DISK0/REBELS_D/COMMON/DNT.PAK;1
/DISK0/REBELS_D/COMMON/FKA.PAK;1
/DISK0/REBELS_D/COMMON/GUI.PAK;1
/DISK0/REBELS_D/COMMON/SND.PAK;1
/DISK0/REBELS_D/HOSPITAL/DATA.PAK;1
/DISK0/REBELS_D/HOSPITAL/DNT.PAK;1
/DISK0/REBELS_D/HOSPITAL/FKA.PAK;1
/DISK0/REBELS_D/HOSPITAL/GUI.PAK;1
/DISK0/REBELS_D/HOSPITAL/PF.PAK;1
/DISK0/REBELS_D/HOSPITAL/SHADOW.PAK;1
/DISK0/REBELS_D/HOSPITAL/SND.PAK;1
Directory listing of /
d--------- 0 0 0 2048 0 1900 [ 19 02] .
d--------- 0 0 0 2048 0 1900 [ 19 02] ..
---------- 0 0 0 273950 Mar 13 2003 [ 307364 00] AUTORUN.EXE;1
---------- 0 0 0 29 Mar 12 2003 [ 307498 00] AUTORUN.INF;1
d--------- 0 0 0 2048 May 6 2003 [ 20 02] DISK0
---------- 0 0 0 4835 Mar 17 2003 [ 307505 00] LICENSE2.TXT;1
---------- 0 0 0 5203 Mar 10 2003 [ 307499 00] LICENSEF.TXT;1
---------- 0 0 0 4327 Mar 10 2003 [ 307502 00] LICENSEG.TXT;1
---------- 0 0 0 4738 Mar 17 2003 [ 307508 00] LICENSEI.TXT;1
---------- 0 0 0 5089 Mar 13 2003 [ 307511 00] LICENSEN.TXT;1
---------- 0 0 0 4504 Mar 10 2003 [ 307514 00] LICENSEU.TXT;1
---------- 0 0 0 52180432 Jun 4 2003 [ 307517 00] SETUP.EXE;1
Directory listing of /DISK0/
d--------- 0 0 0 2048 0 1900 [ 20 02] .
d--------- 0 0 0 2048 0 1900 [ 19 02] ..
---------- 0 0 0 1636 Mar 28 2003 [ 305841 00] CONTROLS.CFG;1
---------- 0 0 0 0 Feb 12 2003 [ 305842 00] DISK0;1
---------- 0 0 0 360 Apr 29 2003 [ 305843 00] DONUT.CFG;1
---------- 0 0 0 9303 Mar 14 2003 [ 305844 00] READMEFR.TXT;1
---------- 0 0 0 9050 Mar 14 2003 [ 305849 00] READMEGE.TXT;1
---------- 0 0 0 8981 Mar 17 2003 [ 305854 00] READMEIT.TXT;1
---------- 0 0 0 9722 Mar 17 2003 [ 305859 00] READMENL.TXT;1
---------- 0 0 0 9074 Mar 17 2003 [ 305864 00] READMESP.TXT;1
---------- 0 0 0 8203 Mar 13 2003 [ 305869 00] READMEUK.TXT;1
---------- 0 0 0 346 Apr 29 2003 [ 305874 00] REBELS.CFG;1
---------- 0 0 0 3026944 May 1 2003 [ 305875 00] REBELS.EXE;1
---------- 0 0 0 21238 Mar 4 2003 [ 307353 00] REBELS64.ICO;1
d--------- 0 0 0 2048 May 6 2003 [ 21 02] REBELS_D
d--------- 0 0 0 2048 May 6 2003 [ 26 02] SAVEGAME
Directory listing of /DISK0/REBELS_D/
d--------- 0 0 0 2048 0 1900 [ 21 02] .
d--------- 0 0 0 2048 0 1900 [ 20 02] ..
d--------- 0 0 0 2048 May 6 2003 [ 22 02] ARCTIC
d--------- 0 0 0 2048 May 6 2003 [ 23 02] CITY
d--------- 0 0 0 2048 May 6 2003 [ 24 02] COMMON
d--------- 0 0 0 2048 May 6 2003 [ 25 02] HOSPITAL
---------- 0 0 0 3011 Mar 11 2003 [ 305740 00] LEVELS.CFG;1
---------- 0 0 0 200704 Mar 25 2003 [ 305742 00] REBELS_T.EXE;1
---------- 0 0 0 88 Mar 10 2003 [ 305840 00] TWEAK.CFG;1
Directory listing of /DISK0/SAVEGAME/
d--------- 0 0 0 2048 0 1900 [ 26 02] .
d--------- 0 0 0 2048 0 1900 [ 20 02] ..
Directory listing of /DISK0/REBELS_D/ARCTIC/
d--------- 0 0 0 2048 0 1900 [ 22 02] .
d--------- 0 0 0 2048 0 1900 [ 21 02] ..
---------- 0 0 0 102322 Apr 29 2003 [ 39 00] DATA.PAK;1
---------- 0 0 0 45512585 Apr 29 2003 [ 89 00] DNT.PAK;1
---------- 0 0 0 7739615 Apr 29 2003 [ 22312 00] FKA.PAK;1
---------- 0 0 0 2962768 Apr 29 2003 [ 26092 00] GUI.PAK;1
---------- 0 0 0 479221 Apr 29 2003 [ 27539 00] PF.PAK;1
---------- 0 0 0 7255310 Apr 29 2003 [ 27773 00] SHADOW.PAK;1
---------- 0 0 0 54826878 Apr 29 2003 [ 31316 00] SND.PAK;1
Directory listing of /DISK0/REBELS_D/CITY/
d--------- 0 0 0 2048 0 1900 [ 23 02] .
d--------- 0 0 0 2048 0 1900 [ 21 02] ..
---------- 0 0 0 103611 Apr 29 2003 [ 58087 00] DATA.PAK;1
---------- 0 0 0 44269023 May 2 2003 [ 58138 00] DNT.PAK;1
---------- 0 0 0 4908571 Apr 29 2003 [ 79754 00] FKA.PAK;1
---------- 0 0 0 4617502 Apr 29 2003 [ 82151 00] GUI.PAK;1
---------- 0 0 0 769211 May 2 2003 [ 84406 00] PF.PAK;1
---------- 0 0 0 14097667 May 2 2003 [ 84782 00] SHADOW.PAK;1
---------- 0 0 0 52163315 Apr 29 2003 [ 91666 00] SND.PAK;1
Directory listing of /DISK0/REBELS_D/COMMON/
d--------- 0 0 0 2048 0 1900 [ 24 02] .
d--------- 0 0 0 2048 0 1900 [ 21 02] ..
---------- 0 0 0 71496701 Apr 29 2003 [ 117137 00] DNT.PAK;1
---------- 0 0 0 89520772 Apr 29 2003 [ 152048 00] FKA.PAK;1
---------- 0 0 0 56689969 Apr 29 2003 [ 195760 00] GUI.PAK;1
---------- 0 0 0 58644114 Apr 29 2003 [ 223441 00] SND.PAK;1
Directory listing of /DISK0/REBELS_D/HOSPITAL/
d--------- 0 0 0 2048 0 1900 [ 25 02] .
d--------- 0 0 0 2048 0 1900 [ 21 02] ..
---------- 0 0 0 109522 Apr 29 2003 [ 252076 00] DATA.PAK;1
---------- 0 0 0 40551719 Apr 29 2003 [ 252130 00] DNT.PAK;1
---------- 0 0 0 2501617 Apr 29 2003 [ 271931 00] FKA.PAK;1
---------- 0 0 0 6333735 Apr 29 2003 [ 273153 00] GUI.PAK;1
---------- 0 0 0 465485 Apr 29 2003 [ 276246 00] PF.PAK;1
---------- 0 0 0 15418051 Apr 29 2003 [ 276474 00] SHADOW.PAK;1
---------- 0 0 0 44516407 Apr 29 2003 [ 284003 00] SND.PAK;1
Path table starts at block 27, size 112
1: 1 13
2: 1 14 DISK0
3: 2 15 REBELS_D
4: 2 1a SAVEGAME
5: 3 16 ARCTIC
6: 3 17 CITY
7: 3 18 COMMON
8: 3 19 HOSPITAL

CD and DVD imaging and quality control notes

Warning

Beware that these notes were primarily written for personal use to keep track of my tests with various imaging tools. They are also pretty unorganised, and need cleaning up at some point. All mentioned tools tested under Linux (Mint); many of them can be used under Windows using Cygwin.

Find the path to the CD drive

mount|grep ^'/dev'

Result:

/dev/sda1 on / type ext4 (rw,errors=remount-ro)
/dev/sr0 on /media/johan/REBELS_0 type iso9660
(ro,nosuid,nodev,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)

So, CD drive is /dev/sr0.

Path on Windows (Cygwin)

In my case /dev/scd0 worked fine (internal drive); /dev/scd1 for external USB drive.

Information about the CD / DVD

Use lsblk. E.g. to get only the label name:

lsblk /dev/sr0 -n -o LABEL

Result:

SRMS41A

Get size in bytes:

lsblk /dev/sr0 -n -o SIZE -b

Result:

660850688

Image CD-rom with dd

This is the simplest tool, mainly suitable for CDs/DVDs that are not damaged. Command-line:

dd if=/dev/sr0 of=mydisk.iso

Output:

1236416+0 records in
1236416+0 records out
633044992 bytes (633 MB) copied, 255,874 s, 2,5 MB/s

Image CD-rom with readom

Recommended here and here as it does some error checking (unlike dd).

More info:

http://linux.die.net/man/1/readom

Command line:

readom dev=/dev/sr0 f=mydisk.iso

Result:

Error trying to open /dev/sr0 exclusively (Device or resource busy)... retrying in 1 second.

Unmount first:

umount /dev/sr0

Then repeat. Works now! Output:

Read  speed:  4234 kB/s (CD  24x, DVD  3x).
Write speed:     0 kB/s (CD   0x, DVD  0x).
Capacity: 309104 Blocks = 618208 kBytes = 603 MBytes = 633 prMB
Sectorsize: 2048 Bytes
Copy from SCSI (10,0,0) disk to file 'gordi_virussen_readom.iso'
end:    309104
addr:   309104 cnt: 44
Time total: 259.287sec
Read 618208.00 kB at 2384.3 kB/sec.

Option retries may be needed to avoid excessive processing times in case of damaged blocks - default is 128.

Image CD-rom with ddrescue

Following Blood Report (page 11):

ddrescue -b 2048 -r4 -v /dev/sr0 REBELS_0.iso REBELS_0.log

Arguments:

  • -b 2048: block size 2048 bytes

  • -r4: retry bad sectors up to four times

  • -v: verbose output mode

From the online help:

Exit status 0 for a normal exit, 1 for environmental problems (file not found, invalid flags, I/O errors, etc), 2 to indicate a corrupt or invalid input file, 3 for an internal consistency error (eg, bug) which caused ddrescue to panic.

In production environment, command line should be added to metadata (PREMIS event).

Log file

# Rescue Logfile. Created by GNU ddrescue version 1.17
# Command line: ddrescue -b 2048 -r4 -v /dev/sr0 REBELS_0.iso REBELS_0.log
# current_pos  current_status
0x28AF0000     +
#      pos        size  status
0x00000000  0x28AFA800  +

The log file structure is explained here. So in this case everything went fine. In production environment, contents of log file should be added to metadata.

Image CD-rom with dcfldd

Alternatively use the dcfldd utility:

dcfldd bs=2048 if=/dev/sr0 of=Handbook_dcfldd.iso errlog=Handbook_dcfldd.log hashlog=Handbook_dcfldd.md5

In my tests, activating the errlog option gave a segmentation fault at the end of the imaging process (the tool does write an intact ISO file; although both the log file and the hash log are empty). Looks like a bug. (Using version 1.3.4-1, which is from 2006; apparently no more recent versions exist?!)

Also, from the Precautions section of forensicswiki.org (link here):

  • dcfldd is based on an extremely old version of dd: it's known that dcfldd will misalign the data in the image after a faulty sector is encountered on the source drive (see the NIST report), and this kind of bug (wrong offset calculation when seeking over a bad block) was fixed for dd in 2003 (see the fix in the mailing list);
  • similarly, dcfldd can enter an infinite loop when a faulty sector is encountered on the source drive, thus writing to the image over and over again until there is no free space left.

So this may not be such a great option after all ...

Roundup of image tool results

All of the above tools are usable, but readom is probably the best options here, followed by ddrescue. The potential advantage of readom is that it uses a library that was specifically written for dealing with optical media, so it might be a bit "smarter" in some respects than ddrescue, which is more generic. On the other hand, ddrescue may often be a better choice CD-ROMs that are damaged (in which case readom gives up easily).

Verify ISO against physical CD

Run checksums on both CD and image, e.g.:

md5sum REBELS_0.iso
md5sum /dev/sr0

Note that readom already does this (dd doesn't). Actually I don't think readom does this either! Needs reference.

Verify ISO image with isovfy

Part of isoinfo. Command line:

isovfy REBELS_0.iso

Result:

Root at extent 13, 2048 bytes
[0 0]
No errors found

So everything OK. Here's an example where the verification fails on an incomplete ISO file:

isovfy gordi_virussen_failed.iso

Result:

Root at extent 16, 2048 bytes
[0 0]
isovfy: Short read on old image

In a production environment, both isovfy command line and its output should be added to metadata (PREMIS event).

Detecting incomplete or truncated ISO files (experimental)

The isovfy documentation isn't very clear what specific checks it performs. In some of my tests I encountered broken (incomplete) ISO images, which were not detected by isovfy. More info here:

http://qanda.digipres.org/1076/incomplete-image-after-imaging-rom-prevent-and-detect-this

This prompted me to write a simple verification script that calculates the expected file size of an ISO from its Primary Volume Descriptor, and compares this against the actual size of the file. It is available here:

https://github.com/KBNLresearch/verifyISOSize

Get information about ISO image with isoinfo

Isoinfo has quite a number of options; here are the ones that look most useful.

Information from the primary volume descriptor

isoinfo -d -i REBELS_0.iso

Result:

CD-ROM is in ISO 9660 format
System id: 
Volume id: REBELS_0
Volume set id: 
Publisher id: 
Data preparer id: 
Application id: NERO - BURNING ROM
Copyright File id: 
Abstract File id: 
Bibliographic File id: 
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 333151
Joliet with UCS level 3 found
NO Rock Ridge present

The same information can also be extracted directly from the CD-rom (i.e. prior to the imaging process) using:

isoinfo -d -i /dev/sr0

This could be useful for automating some of the ddrescue input, such as block size and volume id (which can be used as a base name for the iso file).

Get label (AKA volume ID) from CD/DVD

blkid -o value -s LABEL /dev/sr0

Result:

SRMS41A

(Note that this will also output the device name, but this is sent to stderr).

File/directory listing

isoinfo -f -i REBELS_0.iso

Result:

/AUTORUN.EXE;1
/AUTORUN.INF;1
/DISK0
/LICENSE2.TXT;1
/LICENSEF.TXT;1
/LICENSEU.TXT;1
/SETUP.EXE;1
/DISK0/CONTROLS.CFG;1
/DISK0/DISK0;1
::
::
etc

It looks like all items that are followed by ;1 are files, and those that aren't are directories. Also, the -loption gives a detailed dir listing that includes additional file attributes (size, date, etc.).

Remaining questions

  • How to verify integrity of image file (comparison against source medium)?

Audio CD, readom

Command line:

readom dev=/dev/sr0 f=hooked.bin -clone

The -clone option "retrieve(s) the full TOC and all data".

Output:

Read  speed:  4234 kB/s (CD  24x, DVD  3x).
Write speed:     0 kB/s (CD   0x, DVD  0x).
TOC len: 180. First Session: 1 Last Session: 1.
01 10 00 A0 00 00 00 00 01 00 00 
01 10 00 A1 00 00 00 00 0D 00 00 
01 10 00 A2 00 00 00 00 47 13 21 
01 10 00 01 00 00 00 00 00 02 00 
01 10 00 02 00 00 00 00 05 08 0A 
01 10 00 03 00 00 00 00 0B 32 2D 
01 10 00 04 00 00 00 00 11 35 0A 
01 10 00 05 00 00 00 00 17 33 2D 
01 10 00 06 00 00 00 00 1D 15 05 
01 10 00 07 00 00 00 00 22 21 0F 
01 10 00 08 00 00 00 00 26 2A 3F 
01 10 00 09 00 00 00 00 2B 08 28 
01 10 00 0A 00 00 00 00 30 06 46 
01 10 00 0B 00 00 00 00 35 38 0A 
01 10 00 0C 00 00 00 00 3A 05 21 
01 10 00 0D 00 00 00 00 40 2F 46 
Lead out 1: 320808
Capacity: 320808 Blocks = 641616 kBytes = 626 MBytes = 657 prMB
Sectorsize: 2048 Bytes
Errno: 5 (Input/output error), mode select g1 scsi sendcmd: no error
CDB:  55 10 00 00 00 00 00 00 14 00
status: 0x2 (CHECK CONDITION)
Sense Bytes: 70 00 05 00 00 00 00 0A 00 00 00 00 26 00 00 00
Sense Key: 0x5 Illegal Request, Segment 0
Sense Code: 0x26 Qual 0x00 (invalid field in parameter list) Fru 0x0
Sense flags: Blk 0 (not valid) 
cmd finished after 0.002s timeout 40s
Copy from SCSI (10,0,0) disk to file 'hooked.bin'
end:    320808
addr:   320808 cnt: 80
Time total: 264.775sec
Read 766931.62 kB at 2896.5 kB/sec.

Result: 1 toc file + 1 bin file. Optionally convert toc to cue format:

cueconvert hooked.bin.toc hooked.bin.cue

Doesn't work, apparently no standard toc file?

Audio CD, cdrdao

CD-I (Green Book), cdrdao

Bin file seems to work:

cdrdao read-cd --read-raw --datafile histopathologie_cd_i.bin --device /dev/sr0 --driver generic-mmc-raw histopathologie_cd_i.toc

Output:

Reading toc and track data...

Track   Mode    Flags  Start                Length
------------------------------------------------------------
 1      DATA    4      00:00:00(     0)     48:39:00(218925)
Leadout DATA    4      48:39:00(218925)

PQ sub-channel reading (data track) is supported, data format is BCD.
Raw P-W sub-channel reading (data track) is supported.
Cooked R-W sub-channel reading (data track) is supported.
Copying data track 1 (MODE2_RAW): start 00:00:00, length 48:39:00 to "histopathologie_cd_i.bin"...
Reading of toc and track data finished successfully

Resulting image is slightly larger than aize of CD according to lsblk command. Both how to use it? Readom and ddrescue both fail at imaging these discs at all.

Multi-track / mixed content CDs

These are CDs with one data track and multiple audio tracks.

Make bin / cue file

Tried to use cdrdao to create bin / cue files, following these instructions. Before doing anything with cdrdao we first need to unmount the disc using[^1]:

umount /dev/sr0

Then run cdrdao with the following command line:

cdrdao read-cd --read-raw --datafile no.bin --device /dev/sr0 --driver generic-mmc-raw no.toc

Result: image successfully created; output .toc and .bin file. The*.toc* file looks like this:

CD_DA


// Track 1
TRACK AUDIO
NO COPY
NO PRE_EMPHASIS
TWO_CHANNEL_AUDIO
ISRC "USIR70200001"
FILE "no.bin" 0 02:10:53


// Track 2
TRACK AUDIO
NO COPY
NO PRE_EMPHASIS
TWO_CHANNEL_AUDIO
ISRC "USIR70200002"
FILE "no.bin" 02:10:53 02:17:34

::
etc

But closer inspection shows that only the audio tracks were copied, not the data track! E.g. compare the above output with below example from thecdrdao documentation:

CD_ROM
 TRACK MODE1
 DATAFILE "data_1"
 ZERO 00:02:00 // post-gap

TRACK AUDIO
 SILENCE 00:02:00 // pre-gap
 START
 FILE "data_2.wav" 0

TRACK AUDIO
 FILE "data_3.wav" 0

In particular I would expect the .toc file to start with CD_ROM, and I would also expect one TRACK MODE1 item. So why is this?

Also, cdrdao's output included this message (all output sent to stderr, not stdout):

Found 61 Q sub-channels with CRC errors.
Reading of toc and track data finished successfully.

Assuming that this refers to cyclic redundancy check errors (which are similar to checksums), I'm assuming here that this implies some data errors. Not quite sure how to interpret this in terms of how serious this is. In any case, for (non-mixed) audio CDs cdparanoia looks like a better choice.

Conversion between CUE and TOC

The cdrdao man page mentions that it can read CUE files, whereas it actually writes TOC files. Most emulation-related refs only mention CUE, which appears to be more common. Conversion between the two can be done with the cuetools package. To install it:

sudo apt-get install cuetools

Then convert with the cueconvert tool. To convert a TOC file to CUE:

cueconvert no.toc no.cue

The resulting CUE file looks like this:

FILE "no.bin" WAVE
TRACK 01 AUDIO
ISRC USIR70200001
INDEX 01 00:00:00

TRACK 02 AUDIO
ISRC USIR70200002
INDEX 01 02:10:53
::
etc

Get info about CD/DVD

This also useful (again only works after unmounting the disc first):

cdrdao disk-info --device /dev/sr0

Result:

CD-RW                : no
Total Capacity       : n/a
CD-R medium          : n/a
Recording Speed      : n/a
CD-R empty           : no
Toc Type             : CD-DA or CD-ROM
Sessions             : 2
Last Track           : 18
Appendable           : no

Result in case of CD-I:

CD-RW                : no
Total Capacity       : n/a
CD-R medium          : n/a
Recording Speed      : n/a
CD-R empty           : no
Toc Type             : CD-I
Sessions             : 1
Last Track           : 1
Appendable           : no

Question: what happens if we do this with a DVD?

Ddrescue test

Finally I tried to image the same CD using ddrescue, just to see what happens. I had to interrupt ddrescue manually because it stopped making any progress after some time. Interestingly, isovfy didn't find any errors in the resulting image, whereas isoinfo -d resulted in:

CD-ROM is NOT in ISO 9660 format

Which makes me wonder at how thorough the check by isovfy really is!

Remaining questions

  • How to make imaging of mixed content CDs work correctly with cdrdao?

  • How to render a BIN/CUE image in e.g. an emulated environment?

Audio CDs

Isoinfo on audio CD:

isoinfo -d -i /dev/sr0

Result:

isoinfo: Input/output error. Read error on old image

Crdao disk-info:

cdrdao disk-info --device /dev/sr0

Result:

CD-RW                : no
Total Capacity       : n/a
CD-R medium          : n/a
Recording Speed      : n/a
CD-R empty           : no
Toc Type             : CD-DA or CD-ROM
Sessions             : 1
Last Track           : 13
Appendable           : no

Rip audio CD with cdparanoia

cdparanoia

Install cdparanoia:

sudo apt-get install cdparanoia

Rip CD in batch mode, each track to a separate WAV file:

cdparanoia -B -L

or:

cdparanoia -B -l

The -L switch results in the generation of a detailed log file; -l produces a summary log (name cdparanoia.log). Strangely a parse error occurs when I specify user-defined file names here. Also, it seems the summary file gives more detailed info than the detailed one? Needs more in-depth look!

Remaining questions

  • How are ripped files foreseen to be rendered (play CD as a whole vs separate tracks)? Also needs metadata on track order, perhaps media player play lists.

Automatic disc type detection

From StackOverflow - Determine optical media type (Audio CD, DVD, blu-ray) by using UDEV and scripts.

First install package cdtool:

sudo apt-get install cdtool

Then:

cdir -d /dev/sr0

Output for cd-rom:

unknown cd - 34:32 in 1 tracks
34:30.35  1 [DATA] 

Output for audio CD:

unknown cd - 71:19 in 13 tracks
  5:06.10  1 
  6:42.35  2 
  ::
  etc

Output for mixed content audio/data CD:

unknown cd - 37:52 in 18 tracks
  2:10.53  1 
  2:17.56  2 
  ::
  ::
  5:12.36 17 
  1:29.63 18 [DATA]

Output for DVD:

cdir: no_disc

So the output of the tool makes it possible to differentiate between these 4 disc types. This suggests that it would be feasible to build a workflow that automatically picks the best imaging sub-workflow, based on whether the inserted disc is a cd-rom, audio CD, mixed content CD or DVD.

Rescuing a CD-ROM / DVD with read errors

In this case use ddrescue as it is much more resilient in case of read errors. Also, even if a CD-ROM gives read errors, it may be possible to recover additional data by re-running ddrescue using multiple CD drives. The ddrescue manual gives an example:

Example 3: Rescue a CD-ROM in /dev/cdrom using two CD drives from two different computers, writing the image into an USB drive >nounted on /mnt/mem.

ddrescue -n -b2048 /dev/cdrom /mnt/mem/cdimage /mnt/mem/mapfile
ddrescue -d -r1 -b2048 /dev/cdrom /mnt/mem/cdimage /mnt/mem/mapfile
  (umount the USB drive and move both USB drive and CD-ROM to second
   computer)
ddrescue -d -r1 -b2048 /dev/cdrom /mnt/mem/cdimage /mnt/mem/mapfile
  (if errsize is zero, /mnt/mem/cdimage now contains a complete image
   of the CD-ROM and you can write it to a blank CD-ROM)

Further resources

[^1]: If you don't do this you will get the error message ERROR: Unable to open SCSI device /dev/sr0: Device or resource busy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment