Iso, file/disk size, with multi-session 

Conclusion 

If you could, write as much closer to disk capable size as possible, for your need over 22M of multi-session overhead to be able to write next bit on CD. Ie, if you leave 20M open on CD, it will be totally wasted.

Summary 

cdrecord -multi recording

cdrecord -msinfo

cdrecord -toc

ATIP start of lead out = 335975 = Blocks total.

Blocks current = 194721 = 335975-141254 (Blocks total - last_sess_start)

Blocks remaining = 189589 = 335975-146386 (Blocks total - next_sess_start) excluding session overhead

Example 

MvB040413.4 
357728 extents written (698 Mb)
'du -m $ISOF' = 702
Track 01: data   698 MB
Total size:      802 MB (79:29.73) = 357730 sectors
Lout start:      802 MB (79:31/55) = 357730 sectors

— 802 - 698 = 104

Blocks total: 359849 Blocks current: 359849 Blocks remaining: 2119

Track 01:  698 of  698 MB written (fifo 100%) [buf  99%]  12.2x.
Track 01: Total bytes read/written: 732626944/732626944 (357728 sectors).
% cdrecord -msinfo
cdrecord: Drive needs to reload the media to return to proper status.
cdrecord: Input/output error. read track info: scsi sendcmd: no error
[...]
cdrecord: Cannot read first writable address
% cdrecord -toc
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:lout lba:    357730 (  1430920) 79:31:55 adr: 1 control: 4 mode: -1

— 357730 * 4 = 1430920

MvB040413.5 
286880 extents written (560 Mb)

— 286882/ 512 = 560.316, 286880 / 512 = 560.312

'du -m $ISOF' = 563
Track 01: data   560 MB
Total size:      643 MB (63:45.09) = 286882 sectors
Lout start:      643 MB (63:47/07) = 286882 sectors

— 643 - 560 = 83

Blocks total: 359849 Blocks current: 359849 Blocks remaining: 72967

— 359849 / 512 = 702.83,

— 72967 / 512 = 142.514, 142.514 + 560.312 = 702.826

Track 01:  560 of  560 MB written (fifo 100%) [buf  99%]  12.4x.
Track 01: Total bytes read/written: 587530240/587530240 (286880 sectors).

— 587530240 / 1024 / 1024 = 560.312

— 587530240 Bytes / 286880 Sectors = 2048 B/S

$ cdrecord -msinfo
0,298282

— 298282 - 286882 = 11400

11400 / 512 = 22.2656
$ cdrecord -toc
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:lout lba:    286882 (  1147528) 63:47:07 adr: 1 control: 4 mode: -1

— 286882 * 4 = 1147528

MvB040426.1, right after the MvB040413.5 
$ mkisofs -r -N -L -d -D -J -f -C `cdrecord -msinfo` -M $CDR_DEVICE -o $ISOF MvB$cdate.$cdisk.dar
 83.63% done, estimate finish Wed Apr 28 15:41:51 2004
 85.02% done, estimate finish Wed Apr 28 15:41:51 2004
 [...]
 98.95% done, estimate finish Wed Apr 28 15:41:54 2004
358752 extents written (700 Mb)
% cdrecord -multi -eject -v speed=$CDR_SPEED $ISOF
 [...]
Track 01: data   118 MB
Total size:      135 MB (13:26.29) = 60472 sectors
Lout start:      135 MB (13:28/22) = 60472 sectors
Current Secsize: 2048
 [...]
Blocks total: 359849 Blocks current: 61567 Blocks remaining: 1095
Forcespeed is OFF.
 [...]
Starting to write CD/DVD at speed 12 in real TAO mode for multi session.
BURN-Free is ON.
Turning BURN-Free off
Performing OPC...
Starting new track at sector: 298282
Track 02:  118 of  118 MB written (fifo 100%) [buf  99%]  12.5x.
Track 02: Total bytes read/written: 123842560/123842560 (60470 sectors).
Tip !!

560 + 118 = 678

700 - 678 = 22

----- MvB040426.6

$ mkisofs -r -N -L -d -D -J -f -o $ISOF MvB$cdate.$cdisk.dar*
mkisofs: Warning: -follow-links does not always work correctly; be careful.
Warning: creating filesystem that does not conform to ISO-9660.
 12.64% done, estimate finish Wed Apr 28 17:58:15 2004
 [...]
 88.37% done, estimate finish Wed Apr 28 17:58:16 2004
Total translation table size: 0
Total rockridge attributes bytes: 256
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 6444
39616 extents written (77 Mb)

'du -m $ISOF' = 78

% cdrecord -multi -eject -v speed=$CDR_SPEED $ISOF

Track 01: data    77 MB
Total size:       88 MB (08:48.24) = 39618 sectors
Lout start:       89 MB (08:50/18) = 39618 sectors

Blocks total: 359849 Blocks current: 359849 Blocks remaining: 320231

Track 01:   77 of   77 MB written (fifo 100%) [buf  99%]  12.6x.
Track 01: Total bytes read/written: 81133568/81133568 (39616 sectors).

$ cdrecord -msinfo
0,51018

$ cdrecord -toc
first: 1 last 1
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:lout lba:     39618 (   158472) 08:50:18 adr: 1 control: 4 mode: -1
MvB040428.1, right after the MvB040426.6 

(320231 - 11400) / 512 = 603.186

dar -s 700M -S600M -b -R . -X "*~" -D -c $cdir/MvB$cdate

358272 extents written (699 Mb)

Blocks total: 359849 Blocks current: 308831 Blocks remaining: 1575

Starting new track at sector: 51018
Track 02:  600 of  600 MB written (fifo 100%) [buf  99%]  12.6x.
Track 02: Total bytes read/written: 629256192/629256192 (307254 sectors).

multi-session text archive 

burn #1 

mkisofs 
Total translation table size: 0
Total rockridge attributes bytes: 359932
Total directory bytes: 1073152
Path table size(bytes): 5310
Max brk space used 1c3000
216320 extents written (422 Mb)
File: 443023360
du: 439249920 428955k
df: 432640 1k-blocks
-- 216320 * 2048 = 443023360,
443023360 - 439249920 = 3773440
hex("1c3000") = 1847296, 359932 + 1073152 + 5310 + 1847296 = 3285690
3773440 - 3285690 = 487750
Cdrecord 

burn:

Track 01: data  422 MB
Total size:     485 MB (48:04.29) = 216322 sectors
Lout start:     485 MB (48:06/22) = 216322 sectors
Current Secsize: 2048
Blocks total: 359849 Blocks current: 359849 Blocks remaining: 143527
Track 01: Total bytes read/written: 443023360/443023360 (216320 sectors).

toc:

first: 1 last 1
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:lout lba:    216322 (   865288) 48:06:22 adr: 1 control: 4 mode: -1

msinfo:

0,227722
-- 227722 - 216322 = 11400

multi-session CD-ROM filesystems 

Case 1 

session 1 

TRACK=`cdrecord -msinfo dev=$CDRW`
$ cdrecord  dev=/dev/sg0 -toc
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
scsidev: '/dev/sg0'
devname: '/dev/sg0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'SONY    '
Identifikation : 'CD-RW  CRX175A1 '
Revision       : '5YS2'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO
first: 1 last 5
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:   2 lba:     13002 (    52008) 02:55:27 adr: 1 control: 4 mode: 2
track:   3 lba:     57094 (   228376) 12:43:19 adr: 1 control: 4 mode: 2
track:   4 lba:     92838 (   371352) 20:39:63 adr: 1 control: 4 mode: 2
track:   5 lba:    129142 (   516568) 28:43:67 adr: 1 control: 4 mode: 2
track:lout lba:    134354 (   537416) 29:53:29 adr: 1 control: 4 mode: -1
$ cdrecord -msinfo dev=/dev/sg0
129142,141254

— 141254 - 134354 = 6900

This 6900 is the overhead for CD multi-session. To be precise, it is the overhead for CD-RW multi-session, CD is 11400.

$ mkisofs -r -N -L -d -D -J -f -o $ISOF -graft-points briefcase$TODAY/=.
Warning: creating filesystem that does not conform to ISO-9660.
 99.54% done, estimate finish Sat Dec 28 00:56:33 2002
Total translation table size: 0
Total rockridge attributes bytes: 1307
Total directory bytes: 2048
Path table size(bytes): 26
Max brk space used 7544
5024 extents written (9 Mb)
$ mkisofs -v -v -r -J -f -o $ISOF -C $TRACK  -M /dev/scd0 .
mkisofs 1.14 (i686-pc-linux-gnu)
Rock Ridge signatures found
Scanning .
141282  3924
141284   566 /histories
141285   668 /histories/applications
[...]
Cache hit for /zips/.
Cache hit for /zips/..
Total extents scheduled to be written = 5114
 99.07% done, estimate finish Sat Dec 28 01:03:58 2002
Total translation table size: 0
Total rockridge attributes bytes: 24332
Total directory bytes: 102400
Path table size(bytes): 664
Max brk space used 20000
146368 extents written (285 Mb)
$ cdrecord -multi dev=0,0,0 -eject -v speed=8 $ISOF
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
TOC Type: 3 = CD-ROM XA mode 2
scsidev: '0,0,0'
scsibus: 0 target: 0 lun: 0
Track 01: data   10 MB
Total size:      11 MB (01:08.42) = 5132 sectors
Lout start:      11 MB (01:10/32) = 5132 sectors
Current Secsize: 2048
ATIP start of lead in:  -11940 (97:22/60)
ATIP start of lead out: 335975 (74:41/50)
speed low: 0 speed high: 4
Blocks total: 335975 Blocks current: 194721 Blocks remaining: 189589
Starting to write CD/DVD at speed 4 in write mode for multi session.
Starting new track at sector: 141254
Track 06:  10 of  10 MB written (fifo 100%).
Track 06: Total bytes read/written: 10506240/10506240 (5130 sectors).
ATIP start of lead out = 335975 = Blocks total.
Blocks current = 194721 = 335975-141254 (Blocks total - last_sess_start)
Blocks remaining = 189589 = 335975-146386 (Blocks total - next_sess_start)
$ cdrecord  dev=/dev/sg0 -toc
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:   2 lba:     13002 (    52008) 02:55:27 adr: 1 control: 4 mode: 2
track:   3 lba:     57094 (   228376) 12:43:19 adr: 1 control: 4 mode: 2
track:   4 lba:     92838 (   371352) 20:39:63 adr: 1 control: 4 mode: 2
track:   5 lba:    129142 (   516568) 28:43:67 adr: 1 control: 4 mode: 2
track:   6 lba:    141254 (   565016) 31:25:29 adr: 1 control: 4 mode: 2
track:lout lba:    146386 (   585544) 32:33:61 adr: 1 control: 4 mode: -1

"Track 06: … 10 MB written … Total bytes read/written: 10506240/10506240 (5130 sectors)"

— 5130 * 2048 = 10506240

— 146386 - 141254 = 5132

141254 & 146386 are the session begining & end.

$ cdrecord -msinfo dev=/dev/sg0
141254,153286

— 153286 - 146386 = 6900

Again, the multi-session overhead is 6900.

session 2 

% mkisofs -r -N -L -d -D -J -f -o $ISOF -graft-points briefcase$TODAY/=.
Warning: creating filesystem that does not conform to ISO-9660.
Total translation table size: 0
Total rockridge attributes bytes: 659
Total directory bytes: 2048
Path table size(bytes): 26
Max brk space used 7544
3248 extents written (6 Mb)

% mkisofs -v -v -r -J -f -o $ISOF -C $TRACK  -M /dev/scd0 .
Total extents scheduled to be written = 3354
Total translation table size: 0
Total rockridge attributes bytes: 23674
Total directory bytes: 102400
Path table size(bytes): 664
Max brk space used 1f000
144608 extents written (282 Mb)

% cdrecord -multi dev=0,0,0 -eject -v speed=8 $ISOF

Track 01: data    6 MB
Total size:       7 MB (00:44.74) = 3356 sectors
Lout start:       7 MB (00:46/56) = 3356 sectors

Blocks total: 335975 Blocks current: 182689 Blocks remaining: 179333
Track 07:   6 of   6 MB written (fifo 100%).
Track 07: Total bytes read/written: 6868992/6868992 (3354 sectors).

track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:   2 lba:     13002 (    52008) 02:55:27 adr: 1 control: 4 mode: 2
track:   3 lba:     57094 (   228376) 12:43:19 adr: 1 control: 4 mode: 2
track:   4 lba:     92838 (   371352) 20:39:63 adr: 1 control: 4 mode: 2
track:   5 lba:    129142 (   516568) 28:43:67 adr: 1 control: 4 mode: 2
track:   6 lba:    141254 (   565016) 31:25:29 adr: 1 control: 4 mode: 2
track:   7 lba:    153286 (   613144) 34:05:61 adr: 1 control: 4 mode: 2
track:lout lba:    156642 (   626568) 34:50:42 adr: 1 control: 4 mode: -1
-- 3354 * 2048 = 6868992
-- 156642 - 153286 = 3356
$ cdrecord -msinfo dev=/dev/sg0
153286,163542
-- 163542 - 156642 = 6900

session 3 

$ mkisofs -r -N -L -d -D -J -f -o $ISOF -C $TRACK -M /dev/scd0 -graft-points briefcase$TODAY/=.
Warning: creating filesystem that does not conform to ISO-9660.
Rock Ridge signatures found
Using BRIEF000 for  /briefcase (briefcase2002-12-28)
 98.86% done, estimate finish Sat Dec 28 01:34:58 2002
Total translation table size: 0
Total rockridge attributes bytes: 25213
Total directory bytes: 106496
Path table size(bytes): 696
Max brk space used 20000
166912 extents written (326 Mb)

% cdrecord -multi dev=0,0,0 -eject -v speed=8 $ISOF
Track 01: data    6 MB
Total size:       7 MB (00:44.96) = 3372 sectors
Lout start:       7 MB (00:46/72) = 3372 sectors

Blocks total: 335975 Blocks current: 172433 Blocks remaining: 169061

Test on mkisofs & cdrecord 

Summary 

Final Status 

track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:   2 lba:     11702 (    46808) 02:38:02 adr: 1 control: 4 mode: 2
track:   3 lba:     20054 (    80216) 04:29:29 adr: 1 control: 4 mode: 2
track:lout lba:     20356 (    81424) 04:33:31 adr: 1 control: 4 mode: -1

First write 

Track 01: data    0 MB         padsize: 504 KB
Total size:       0 MB (00:04.02) = 302 sectors
Lout start:       1 MB (00:06/02) = 302 sectors

Second write 

$ cdrecord -msinfo dev=/dev/sg0
MULTI_INFO=0,11702
Track 02: Total bytes read/written: 2969600/2969600 (1450 sectors).

— 11702 + 1450 = 13152

Third write 

$ cdrecord -msinfo dev=/dev/sg0
MULTI_INFO=11702,20054
Starting new track at sector: 20054
Track 03:   0 of   0 MB written.
Track 03: writing 228 KB of pad data.
Track 03: Total bytes read/written: 380928/614400 (300 sectors).

— 20054 + 300 +2 = 20356

First write 

work log 

Getting disc info

$ cdrecord -msinfo dev=/dev/sg0
MULTI_INFO=0,11702
+ mkisofs -R -T -f -o /tmp/backup.img /tmp/backupshadow
Total translation table size: 46
Total rockridge attributes bytes: 326
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 4544
48 extents written (0 Mb)

+ cdrecord dev=/dev/sg0 -multi -eject -v speed=4 /tmp/backup.img
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
TOC Type: 3 = CD-ROM XA mode 2
cdrecord: Operation not permitted. WARNING: Cannot do mlockall(2).
cdrecord: WARNING: This causes a high risk for buffer underruns.
cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler
cdrecord: Permission denied. WARNING: Cannot set priority using setpriority().
cdrecord: WARNING: This causes a high risk for buffer underruns.
scsidev: '/dev/sg0'
devname: '/dev/sg0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
atapi: 1
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'SONY    '
Identifikation : 'CD-RW  CRX175A1 '
Revision       : '5YS2'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO
Drive buf size : 1966272 = 1920 KB
FIFO size      : 4194304 = 4096 KB
Track 01: data    0 MB         padsize: 504 KB
Total size:       0 MB (00:04.02) = 302 sectors
Lout start:       1 MB (00:06/02) = 302 sectors
Current Secsize: 2048
ATIP info from disk:
  Indicated writing power: 5
  Reference speed: 2
  Is not unrestricted
  Is erasable
  ATIP start of lead in:  -11940 (97:22/60)
  ATIP start of lead out: 335975 (74:41/50)
  speed low: 0 speed high: 4
  power mult factor: 3 5
  recommended erase/write power: 2
  A2 values: 5A A6 14
Disk type:    Phase change
Manuf. index: 43
 Manufacturer: Acer Media Technology, Inc.
Blocks total: 335975 Blocks current: 335975 Blocks remaining: 335673
cdrecord: Operation not permitted. WARNING: Cannot set RR-scheduler
cdrecord: Permission denied. WARNING: Cannot set priority using setpriority().
cdrecord: WARNING: This causes a high risk for buffer underruns.
Starting to write CD/DVD at speed 4 in write mode for multi session.
Last chance to quit, starting real write in 0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
Performing OPC...
Starting new track at sector: 0
Track 01:   0 of   0 MB written.
Track 01: writing 504 KB of pad data.
Track 01: Total bytes read/written: 98304/614400 (300 sectors).
Writing  time:   13.534s
Fixating...
Fixating time:   79.694s
cdrecord: fifo had 2 puts and 2 gets.
cdrecord: fifo was 0 times empty and 0 times full, min fill was 100%.

Result 

Only two files written to the cd, TRANS.TBL & DATE.

Second write 

work log 

Getting disc info

$ cdrecord -msinfo dev=/dev/sg0
MULTI_INFO=0,11702
+ mkisofs -R -T -f -o /tmp/backup.img -C 0,11702 -M /dev/scd0 /tmp/backupshadow
Rock Ridge signatures found
Total translation table size: 598
Total rockridge attributes bytes: 1208
Total directory bytes: 0
Path table size(bytes): 10
Max brk space used 4000
13152 extents written (25 Mb)

Performing OPC...
Starting new track at sector: 11702
Track 02:   2 of   2 MB written (fifo 100%).
Track 02: Total bytes read/written: 2969600/2969600 (1450 sectors).
Writing  time:    9.640s
Fixating...
Fixating time:   40.618s
cdrecord: fifo had 47 puts and 47 gets.
cdrecord: fifo was 0 times empty and 0 times full, min fill was 100%.

Result 

the whole /export/baks directory get written it. But the file case and name is odd, because of the format it chose.

11702 (new track starting sector) - 302 (last session total sectors) = 11400

Third write 

work log 

Getting disc info

$ cdrecord -msinfo dev=/dev/sg0
MULTI_INFO=11702,20054
+ mkisofs -r -N -L -d -D -J -f -o /tmp/backup.img -C 11702,20054 -M /dev/scd0 /tmp/backupshadow
Warning: creating filesystem that does not conform to ISO-9660.
Rock Ridge signatures found
Using KS8000.CFG for  /tmp/backupshadow/ks/ks8.cfg,v (ks8.cfg)
Total translation table size: 0
Total rockridge attributes bytes: 4478
Total directory bytes: 6144
Path table size(bytes): 20
Max brk space used a000
20240 extents written (39 Mb)

Performing OPC...
Starting new track at sector: 20054
Track 03:   0 of   0 MB written.
Track 03: writing 228 KB of pad data.
Track 03: Total bytes read/written: 380928/614400 (300 sectors).
Writing  time:    5.706s
Fixating...
Fixating time:   40.638s
cdrecord: fifo had 6 puts and 6 gets.
cdrecord: fifo was 0 times empty and 0 times full, min fill was 100%.

Result 

The ks directory under /export/baks is appended. The file names show correctly this time, including long file names.

Check the result and space. 

# cdrecord -msinfo dev=/dev/sg0
20054,27256

# cdrecord  dev=/dev/sg0 -toc
Cdrecord 1.10 (i686-pc-linux-gnu) Copyright (C) 1995-2001 Jorg Schilling
scsidev: '/dev/sg0'
devname: '/dev/sg0'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.1.24
Using libscg version 'schily-0.5'
Device type    : Removable CD-ROM
Version        : 0
Response Format: 2
Capabilities   :
Vendor_info    : 'SONY    '
Identifikation : 'CD-RW  CRX175A1 '
Revision       : '5YS2'
Device seems to be: Generic mmc CD-RW.
Using generic SCSI-3/mmc CD-R driver (mmc_cdr).
Driver flags   : SWABAUDIO
first: 1 last 3
track:   1 lba:         0 (        0) 00:02:00 adr: 1 control: 4 mode: 2
track:   2 lba:     11702 (    46808) 02:38:02 adr: 1 control: 4 mode: 2
track:   3 lba:     20054 (    80216) 04:29:29 adr: 1 control: 4 mode: 2
track:lout lba:     20356 (    81424) 04:33:31 adr: 1 control: 4 mode: -1

$ du -k
254     ./ks
3066    .

Conclusion