CD info 

Capacity 

650M disk: 74:02:xx, 650.83M, 665600K, 681574400B, 335975 Blocks
700M disk: 79:57:70, 702.83M, 718848K, 736100352B, 359849 Blocks

You can fit on a CD without overburning:

You can fit on a S/VCD without overburning:

Get CD info 

export CDR_DEVICE=ATA:0,0,0
export CDR_DEVICE=ATA:1,0,0
export CDR_DEVICE=ATA:1,1,0
export CDR_DEVICE=0,0,0
export CDR_DEVICE=ATAPI:0,0,0
export CDR_DEVICE=ATAPI:0,1,0
CDR_SPEED=8
CDR_SPEED=12
CDR_SPEED=16
export CDR_SPEED=20

NB, the env var CDR_DEVICE & CDR_SPEED can only be recognized by cdrecord.

about CD disks 

cdrecord -toc

-toc Retrieve and print out the table of content or PMA of a CD.

cdrecord -msinfo

-msinfo Retrieve multi session info

cdrecord -atip

-atip Retrieve and print out the ATIP (absolute Time in Pregroove) info

Empty CDRW 

cdrecord blank=fast

CD device names 

wodim devices 

$ cdrecord --devices
wodim: Overview of accessible drives (3 found) :
 0  dev='/dev/hda'      rwrw-- : 'SONY' 'CD-RW  CRX195E1'
 1  dev='/dev/hdc'      rwrw-- : 'HL-DT-ST' 'CD-RW GCE-8526B'
 2  dev='/dev/hdd'      rwrw-- : 'PIONEER' 'DVD-RW  DVR-110D'

ATA 

$ cdrecord -scanbus dev=ATA
scsibus0:
        0,0,0     0) *
        0,1,0     1) '        ' 'ATAPI CDROM 52X ' '120N' Removable CD-ROM
        0,2,0     2) *
        ....
scsibus1:
        1,0,0   100) 'CDWRITER' 'IDE4012         ' '409E' Removable CD-ROM
        1,1,0   101) *
        1,2,0   102) *
        ...

ATAPI 

cdrecord 

$ cdrecord -scanbus dev=ATAPI
scsidev: 'ATAPI'
devname: 'ATAPI'
scsibus: -2 target: -2 lun: -2
Using libscg version 'schily-0.8'.
scsibus0:
        0,0,0     0) 'SONY    ' 'CD-RW  CRX195E1 ' 'ZYS5' Removable CD-ROM
        0,1,0     1) 'Toshiba ' 'DVD-ROM SD-M1712' '1808' Removable CD-ROM
        0,2,0     2) *
cdrecord dev=help

cdrdao 

$ cdrdao scanbus
Cdrdao version 1.1.9 - (C) Andreas Mueller <andreas@daneb.de>
Using libscg version 'schily-0.8'
ATAPI:0,0,0          SONY    , CD-RW  CRX195E1 , ZYS5
ATAPI:0,1,0          Toshiba , DVD-ROM SD-M1712, 1808

CD limit info 

file name length max 

With all iso9660 levels all filenames are restricted to upper case letters, numbers and the underscore (_). The maximum filename length is restricted to 31 characters, the directory nesting level is restricted to 8 and the maximum path length is limited to 255 characters.

The Joliet directory records in addition to regular iso9660 file names. This is primarily useful when the discs are to be used on Windows-NT or Windows-95 machines. The Joliet filenames are specified in Unicode and each path component can be up to 64 Unicode characters long. Joliet uses the UTF-16 coding for Unicode characters.

The '-joliet-long' swith for mkisofs allows Joliet filenames to be up to 103 Unicode characters. This breaks the Joliet specification - but appears to work. Use with caution. The number 103 is derived from: the maximum Directory Record Length (254), minus the length of Directory Record (33), minus CD-ROM XA System Use Extension Information (14), divided by the UTF-16 character size (2).

Disk-info 

$ cdrdao disk-info --device 0,0,0
0,0,0: SONY CD-RW  CRX195E1     Rev: ZYS5
Using driver: Generic SCSI-3/MMC (raw writing) - Version 2.0 (options 0x0000)
CD-RW                : no
Total Capacity       : n/a
CD-R medium          : Ritek Co.
                       Short Strategy Type, e.g. Phthalocyanine
Recording Speed      : n/a
CD-R empty           : no
Toc Type             : CD-ROM XA
Sessions             : 1
Last Track           : 2
Appendable           : no

capacity example 

On Disk: 33675 files, 105 folders, 645MB (677,217,436B), Usage: 1,139MB(by GaugeIt) 1,016MB(by Explorer) By EzCreater: 33676 files, 106 folders, 693.3MB On Final CD: ==> 696MB

Large disk example 

VC6 

My Vc6 disk has 11847 files and 553 folders. Cd creater 5 reported that it would take up to 694M, with 8M free disk spaces. But the actual CD is 697.76M. I lost 3 blank CDs trying to add 5M more to it. :-(

To recap, 12k files, 0.5k folders take about 4M of overhead not reported by Easy CD creater. 3k files ~ 1M CD overhead.

CD-Recordable FAQ 

http://www.cdrfaq.org/

Last-modified: 2005/05/20 Version: 2.59

[2] CD Encoding
[2-1] How is the information physically stored?
[2-2] What is XA? CDPLUS? CD-i? MODE1 vs MODE2? Red/yellow/blue book?
[2-3] How do I know what format a disc is in?
[2-4] How does copy protection work?
[2-4-1] ...on a data CD-ROM?
[2-4-2] ...on an audio CD?
[2-4-3] ...on an audio CD (Macrovision - SafeAudio)
[2-4-4] ...on an audio CD (SunnComm - MediaCloQ and MediaMax CD3)
[2-4-5] ...on an audio CD (Midbar Tech - Cactus Data Shield)
[2-4-6] ...on an audio CD (Key2Audio / Sony DADC)
[2-4-7] ...on an audio CD (BayView Systems - Duolizer)
[2-4-8] ...on an audio CD (Sanyo)
[2-4-9] How does the Doc-Witness OpSecure CD-ROM work?
[2-5] What's a multisession disc?
[2-6] What are subcode channels?
[2-7] Are the CD Identifier fields widely used?
[2-8] How long does it take to burn a CD-R?
[2-9] What's the difference between disc-at-once and track-at-once?
[2-10] Differences between recording from an image and on-the-fly?
[2-11] How does an audio CD player know to skip data tracks?
[2-12] How does CD-RW compare to CD-R?
[2-13] Can DVD players read CD-Rs?
[2-14] Should I buy a DVD recorder instead?
[2-15] What are "jitter" and "jitter correction"?
[2-16] Where can I learn more about the history of CD and CD-R?
[2-17] Why don't audio CDs use error correction?
[2-18] How does CD-R compare to MiniDisc?
[2-19] What does finalizing (and closing and fixating) do?
[2-20] How are WAV/AIFF files converted into Red Book CD audio?
[2-21] What does MultiRead mean? MultiPlay?
[2-22] If recording fails, is the disc usable?
[2-23] Why do recorders insert "00" bytes at the start of audio tracks?
[2-24] How many tracks can I have? How many files?
[2-25] Will SCMS prevent me from making copies?
[2-26] Is a serial number placed on the disc by the recorder?
[2-27] What's a TOC? How does it differ from a directory?
[2-28] What's an ISO? A CIF? BIN and CUE? .DAT?
[2-29] Why was 74 minutes chosen as the standard length?
[2-30] Why is there a visibly unwritten strip near the CD-R hub?
[2-31] What is "BURN-Proof"? "JustLink"? "Waste-Proof"?
[2-32] Can playing CD-Rs in a DVD player hurt the discs?
[2-33] Who *really* made this CD-R blank?
[2-34] Can I make copies of DTS-encoded CDs?
[2-35] Why 44.1KHz? Why not 48KHz?
[2-36] What format are .CDA files in?
[2-37] What are DD-R and DD-RW?
[2-38] What's an ATIP?
[2-39] What are "ML" discs and devices?
[2-40] What's CD-MRW? Mount Rainier? EasyWrite?
[2-41] What's Audio Master Quality (AMQ) recording?
[2-42] Can I draw pictures on a disc with the recording laser?
[2-43] What are the gory details about how are 1s and 0s encoded?
[2-43-1] How does the laser read or write a disc?
[2-43-2] How do pits and lands turn into 1s and 0s? What's EFM?
[2-43-3] What's a frame? CIRC encoding? How does ECC work?
[2-43-4] What's in a sector?
[2-43-5] What's in a subcode channel?
[2-43-6] I want even more details
[2-44] Digital is better than analog, right?
[2-44-1] What is "digital" and "digitization", anyway?
[2-44-2] How does this relate to CD-DA?
[2-45] What's a CDR-ROM? CD-PROM?
[2-46] What's HD-BURN? GigaRec?
[2-47] What are C2 errors? What do they say about disc quality?
[2-48] What are CD+R and CD+RW?
[2-49] What's HighMAT?
[2-50] What's VariRec?
[2-51] Will my CDs work on players in other countries?
[2-52] Do CD-Rs have deeper pits? Are "shallow burns" bad?
[2-53] What's a stacking ring?

The Linux CD-ROM HOWTO 

http://www.linux.com/howtos/CDROM-HOWTO/x1186.shtml

How can I tell what speed CD-ROM I have? 

Here's one way. This command measures how long is takes to read 1500K of data from CD:

% time -p dd if=/dev/cdrom of=/dev/null bs=1k count=1500
1500+0 records in
1500+0 records out
real 5.24
user 0.03
sys 5.07

The transfer rate of single speed drives is 150 kilobytes per second, which should take about 10 seconds. At double speed it would take five seconds, quad speed would take 2.5, etc.

The "real" time above is probably the best number to look at — in this case it indicates a double speed drive. You can increase the amount of data transferred to get a more accurate value (the data does not get cached). You should probably run the command a few times and take the average.

How do I read a CD volume label? 

There is a small utility called volname included with recent versions of the eject program. Alternatively you can run this shell command:

dd if=/dev/cdrom bs=1 skip=32808 count=32

assuming /dev/cdrom is the device file name for your drive.

documented on: 2005.07.22

Data capacity of CDs 

http://www.videohelp.com/forum/archive/t135642.html

vitualis posted 2003 Jan 08

Abstract 

You can fit on a S/VCD without overburning:

You can fit on a CD-ROM without overburning:

Introduction 

Let us ignore for now the terms of megabyte for CD capacity and try to understand how the data is stored on a CD.

As well all know, the data is stored digitally as binary data. This means, however the actual information is actually kept on the disc, this information is in the form of "1"s and "0"s. Physically, the information on a CD is as pits on a thin sheet of metal (aluminium).

An a CD-R disc, the data is physically on an organic dye layer which simulates the metal layer on a real pressed CD.

How is the information structured 

Now, on the CD, the information isn't just organised from beginning to end willy-nilly. Otherwise, it would be really hard to find a useful piece of information on the CD.

Rather, the information is organised in sectors. Consider a sector as like a page in a book. Just like you are able to quickly find something in a book if you know the page number, you can quickly find something on a CD if you know the sector number.

Now, remember that the CD was original made to hold audio data. It was decided, that the CD would would 75 sectors per second of audio. Although I cannot guess where this number comes from, it is quite appropriate for the audio CD. It means that you can "seek" an audio CD accurately to 1/75th of a second — which is more than enough for consumer purposes.

Now, with this in mind, we can work out the total data capacity of user data for 1 sector.

The total data capacity of user data of 1 sector on a CD 

CD audio uses uncompressed PCM stereo audio, 16-bit resolution sampled at 44.1 kHz.

Thus 1 second of audio contains: 16 bits/channel * 2 channels * 44100 samples/second * 1 second

= 1411200 bits
= 176400 bytes

Since there are 75 sectors per second 1 sector

= 176400 bytes / 75
= 2352 bytes

One sector on a CD contains 2352 bytes max.

The concept of different MODES and FORMS of burning 

Now, audio CD was well and good, but the medium would become much more useful if you could store other data on the disc as well. This became to be know as CD-ROM of course.

Now, the audio-CD uses the ENTIRE sector for audio data.

However, for CD-ROMs this caused a problem. Simply, CDs and the CD reading mechanisms were not 100% faultless. That is, errors (indeed frequent errors) could be made during the reading. For audio CDs, this does not matter as much as you could simply interpolate from the adjacent audio samples. This will obviously NOT DO for data CDs. A single bit error could lead to a program being unexecutable or ruin an achive file.

Thus, for CD-ROMs, part of each sector is devoted to error correction codes and error detection codes. The CD-R FAQ has the details, but in effect, only 2048 bytes out of a total of 2352 bytes in each sector is available for user data on a data CD.

This burning mode is either MODE1 or MODE2 Form1.

MODE2 Form2 sectors of VCDs and SVCDs 

Now, for VCDs and SVCDs, the video tracks do not necessarily require the robust error correction as normal data on a CD-ROM. However, there is still some overhead per sector that is used for something other than video data (e.g., sync headers).

S/VCDs video tracks are burnt in what is called MODE2 Form2 sectors. In this mode, only 2324 bytes out of a total of 2352 bytes in each sector is available for user data.

This is MUCH MORE than for CD-ROMs, but still less per sector than audio CD.

The disc capacities of CD-ROMs, audio-CDs and VCDs 

Now, obviously what ultimately determines the capacity of a disc is the total number of sectors it contains. This is similar to the total number of pages in a blank exercise book (if you recall the book analogy).

The secondary determinant is the burning mode of the disc.

For audio CDs, it is as if you could fill each page from top to bottom with audio data as the entire sector is used for audio data.

For CD-ROMs, it is as if you need to first rule a margin and then leave the bottom part of each page for footnotes (headers ` ECC ` EDC). The amount of text you can actually write per page is then less due to these other constraints.

For S/VCDs, we still need to rule a margin on the page, but we don't have to worry about the footnotes (headers). We can fit MORE text than a CD-ROM, but less than an audio-CD.

Now remember, 1 second on a CD = 75 sectors.

Thus:

Data capacity in Mb for an audio-CD

74 min
= 333,000 sectors * 2352 bytes / sector
= 783216000 bytes
= 746.9 Mb
80 min
= 360,000 sectors * 2352 bytes / sector
= 846720000 bytes
= 807.5 Mb
Data capacity in Mb for a CD-ROM
74 min
= 333,000 sectors * 2048 bytes / sector
= 681984000 bytes
= 650.4 Mb
80 min
= 360,000 sectors * 2048 bytes / sector
= 737280000 bytes
= 703.1 Mb

Data capacity in Mb for a S/VCD

74 min
= 333,000 sectors * 2324 bytes / sector
= 773892000 bytes
= 738.0 Mb
80 min
= 360,000 sectors * 2324 bytes / sector
= 836640000 bytes
= 797.9 Mb

Conclusions 

As you can see, the often quoted capacities of 650MB and 700MB refer to CD-ROM capacities.

Due to the fact that S/VCDs use a different burning mode where MORE of each sector is available as user data, the relatively capacities are HIGHER.

Now, since S/VCDs are not composed of PURELY video tracks and have some unavoidable overheads, the actually total capacity left for video tracks is a few Mb less for each disc (about 735 Mb for 74min discs and 795 Mb for 80min discs). This is where the often quoted capacities of 740MB and 800MB come from. They are quite accurate.

All these capacities are available BEFORE overburning. Overburning is where you burn MORE sectors than the disc is rated for. If you overburn, you can typically achieve about 1-2 minutes of additional capacity (depending on your drive and media).

I hope this finally puts this topic to rest! ;-)

Conclusions 

Thanks for the info! To quote directly from Philips:

September 30, 2002 High Capacity Recordable Disc system, Version 0.9, dated Sept 2002

This document describes High Capacity Recordable discs with a maximum single session time of 98 minutes, 29 seconds, 74 frames on 12 cm discs. For 8cm discs the playing time will be roughly 30 minutes.

The recorded High Capacity Recordable is not fully compliant with the Red Book, but will be playable on the majority of the installed base CD players. To avoid any misunderstanding about the compatibility of the High Capacity Recordable Discs: The use of a CD logo is not allowed on this disc.

Wow, Philips is disallowing the use of the CD logo on these discs! :o

In any case, 98 min, 29 sec and 74 frames = 443249 sectors

Thus, in terms of max. user data capacity (without overburning): Audio CD (or 2352 bytes per sector): — size of WAV files in Mb

= 443249 sectors * 2352 bytes/sector
= 1042521648 bytes
= 994.2 Mb

S/VCD (or 2324 bytes per sector): — size of MPEG in Mb

= 443249 sectors * 2324 bytes/sector
= 1030110676 bytes
= 982.4 Mb

Remember, there is usually up to 10 seconds of unavoidable overhead on a S/VCD so the max. size of MPEG you can put on without overburning is closer to 980 Mb.

CD-ROM (or 2048 bytes per sector): — size of data in Mb

= 443249 sectors * 2048 bytes/sector
= 907773952 bytes
= 865.7 Mb

vitualis posted 2003 Jan 08

CD related forums 

http://www.videohelp.com/forum/

Linux Video Forum http://www.videohelp.com/forum/viewforum.php?f=19

Imaging A CD and replacing a file 

Date: 24 Sep 2002 01:53:42 GMT
Newsgroups: comp.os.linux.misc
> > I have a bootable CD, which includes a kickstart file for installing
> > linux.   Is there a way to image the CD, so that I retain the boot
> > portion (the boot portion is not linux), mount the image, and overwrite
> > the specific kickstart file and reimage a new cd.
> Try using dd to extract the image to a regular file then mount the
> file (cd image) using loopback and make sure you pass the rw option.

Won't work. ISO9660 filesystem support is read-only (append-only if you want to get pedantic) because of the way ISO9660 is structured. The filesystem is so minimal that there's just no provision for overwriting existing files.

The best way for the OP to go about doing what he wants to do is to figure out what the bootable image on the CD is and then feed that into the mkisofs command. After doing a quick "od -xc /dev/cdrom | more" on my SuSE 8.0 CDs, I found the mkisofs command used to create the ISO at offset 0xA000 . So if I wanted to do something similar to my SuSE CDs, I'd copy the entire CD to somewhere on the hard disk, change the files I needed to change, then execute the mkisofs command at offset 0xA000 and feed the resulting ISO to cdrecord.

Matt G