Creating multi-session CDs/DVDs Mini Howto FAQ

Multi-session filesystems are a trick that comes from the Kodak photo CD.
The OS mounts the last session that contains the sum of the current session
and all previous sessions.

To test (with Linux):

 - create a iso-9660 filesystem image with genisoimage.
 - genisoimage is included in the cdrkit release.
 - use the -R flag to add Rock Ridge extensions (this is important).

Assuming that the CD-R drive is connected to target 2 on the SCSI bus.

Write the first session with:

wodim -v speed=2 dev=2,0 -eject -multi isoimage.raw

Note that all Sony drives do no support XA2 disks in firmware - read README.sony
for more information.

This must be a iso9660 image with Rock Ridge extensions (see above)

Note the number of sectors written and check the disk, it should be mountable.

Next step is to check if wodim is able to retrieve the following data:

	1) The first block (sector) number in the first track of the last session
	   This must be '0' in our case.

	2) The next writable address in the unwritten session following the current.
	   This should be the number of sectors written in the first
	   run + ~ 11400 sectors for about 22MB lead out/in

	   For the first additional session this is 11250 sectors lead-out/lead-in
	   overhead + 150 sectors for the pre-gap of the first track after the
	   lead-in = 11400 sectors.

	   For all further session this is 6750 sectors lead-out/lead-in
	   overhead + 150 sectors for the pre-gap of the first track after the
	   lead-in = 6900 sectors.

To get this information type:

wodim -msinfo dev=2,0

The output should be two numbers separated by a comma.

	e.g.: 0,204562

The first number is (1), the second number is (2).

2nd session:
You should create a directory that contains a second directory with data in it
for this purpose.

	e.g.:
		first_dir/
			second_dir/
				file_1
				file_2
				...

call:

On Linux:
genisoimage -o isoimage_2.raw -R  -C xx,yy -M /dev/cdwriter_blk_dev  first_dir

On SunOS:
genisoimage -o isoimage_2.raw -R  -C xx,yy -M target,lun first_dir

Note that the name "first_dir" is not important.

If you still keep the old raw image of the first session and there is only
one previous session on the CD you may also call:

genisoimage -o isoimage_2.raw -R  -C xx,yy -M isoimage.raw first_dir


The argument of -C is the output of wodim -msinfo
-	On Linux, the argument of -M is a device that would allow you to mount 
	the current CD in the CD-writer
-	On SunOS, target and lun refer to the SCSI target and lun of the 
	CD-R device with the same notation as for wodim dev=xxx,yyy .

Note that you can also use the -msifile=... option of wodim to store this data
in a reliable way. This is usefull for scripting.

If you want to check, whether genisoimage make everything right, you should create 
another image by using the following command line.

On Linux:
genisoimage -o isoimage_2.raw -R  -C xx,0 -M /dev/cdwriter_blk_dev  first_dir

On SunOS:
genisoimage -o isoimage_2.raw -R  -C xx,0 -M target,lun first_dir

Where xx is the first number of the pair returned by wodim -msinfo

You may check ***this** image by mounting it with my "fbk" on Solaris 
or the loopback driver on Linux.

On Linux type:
	mount isoimage_2.raw -r -t iso9660 -o loop /mnt

On SunOS type:
	mount -r -F fbk -o type=hsfs /dev/fbk0:isoimage_3.raw /mnt

For Solaris 8 and later you may also use the Sun lofi driver (see README.sun-lofi)

If you list /mnt, you should see all directories that have been in the first 
session and the directory "second_dir". If you try to read a file from the
first session, you will get an I/O error or bad data (depending on the
block address), don't worry about that. If you try to read a file from
the second session, you will see everything correctly.

To write the second session to CD, call:

wodim -v speed=2 dev=2,0 -eject -multi isoimage_2.raw

If you mount this CD, you should see the first session and the second directory 
from 2nd session added to the root directory of the CD.


Additional check:

call:

wodim -msinfo dev=2,0

The first number should be the first writable address which was retrieved by the
first call to wodim -msinfo after creating the first session.
The second number should be the first number + number of sectors of the second session
+ ~ 11400 sectors.

Note: The first lead-out is 1:30 (6750 sectors) the lead-in is 1:00 (4500 sectors)
All following sessions need only 0:30 for lead-out (2250 sectors), the lead-in
is also 1:00. So in theory, the can be 44 sessions on s 74 minute disk if you
take into account that the minimum track size is 4 seconds.

The total amount of the overhead is 11250 + 150 sectors for the first additional
session and 6750 + 150 sectors for all subsequent sessions.
The 150 additional sectors are the pre-gap sectors for the first track after
the current session.

Some notes on multi-session CD's that contain only Joliet but no Rock Ridge:

Joliet is a really bad idea in general:

-	There is no way to find a relation between a ISO-9660 name and a Joliet
	name. If the file has a size, you may try to match the starting sector #
	but if the size in 0 it's impossible.


-	Joliet does not allow long filenames (it limits names to 64 chars).

-	Joliet does not allow all (usually used) characters in filenames.
         
	All code points between (00)(00) and (00)(1F), inclusive. (Control Characters)
		(00)(2A) '*'(Asterisk)
		(00)(2F) '/' (Forward Slash)
		(00)(3A) ':' (Colon)
		(00)(3B) ';' (Semicolon)
		(00)(3F) '?' (Question Mark)
		(00)(5C) '\' (Backslash) 

	While '/' is not a real problem ;-) other characters may cause trouble.
 
All notes above prevent you from doing reliable multi-session if the CD does
only contain Joliet but des not contain Rock Ridge attributes.

In addition, please read README.joliet in the genisoimage directory.

This is the answer to a commonly asked question is why can't I continue a
multisession CD that has been started on a Microsoft system using genisoimage. 


Note: It is not possible to create a multi-session HFS CD. If you create
a multi-session CD using any of the HFS options, then each new HFS
session will ignore HFS files from any previous sessions. A warning will
be printed if you attempt this. However, if you use the '-part' option to
genisoimage for each session you create, then each session will appear as 
separate volumes when mounted on a Mac. In this case, it is worth using the 
'-V' or '-hfs-volid' option to give each session a unique volume name,
otherwise each "volume" will appear on the Desktop with the same name.


Joerg Schilling

Edited for cdrkit by Christian Fromme <kaner@strace.org> and Eduard Bloch


This describes the programs as shipped with cdrkit, a spinoff from the
cdrtools project. However, the cdrtools developers are no longer
involved in the development of this spinoff and therefore shall not
be made responsible for any problem caused by it. Do not try to get
support for this program by contacting the original authors.

If you have support questions, send them to

debburn-devel@lists.alioth.debian.org

If you have definitely found a bug, send a mail to this list or to

submit@bugs.debian.org

writing at least a short description into the Subject and "Package: cdrkit" 


