[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Thoughts on writing CD from stdin



> I don't obviously see why CD burning requires the size in advance,
> but cdrecord and similar seem to want it.

The meta-data for the iso9660 is in the "primary volume descriptor"
(PVD) which is (more or less) written first.  One of its fields is the
location of the root directory which varies from one instance of the
iso9660 file system to the next.

The obvious thing to try is to put the root directory (more or less)
immediately after the PVD.  With read-only media, this can be a
problem because there is no way to go back and fill in missing
information -- like the size of files.

So when the size of stdin is not known in advance, there isn't much
choice: the PVD must be written very early, and the PVD must specify
the location of the root directory.

Thus, the only way to not waste space in the general case is to put
the root directory at the end of the iso9660 file system and collect
all the information needed for the root directory as it is written.

Incidentally, this is why burning iso9660 images to DVDs was broken on
linux for so long.  Software put the root file system at the end of
the media.  For a DVD, the end of media is greater than 4GB which
could not be seen because linux was using a 32-bit, byte-oriented
inode scheme.



> What would be useful is [application]->[burning_software]->media
> without buffering.

If by "media without buffering" you mean the padding between the end
of data and the block that holds the root file system, I don't think
it's possible in the general case.

If by "media without buffering" you mean the padding that goes at the
end of media after everything has been written and that causes things
like "dd if=/dev/scd0" to read too much data (on linux), a general
solution that allows spanning stdin across multiple CDs and DVDs is
shunt and flyisofs:

    shunt -c "tar -cf - . | gzip -c" \
           + "flyisofs mbc=358400 fbc=358400 \
                | cdrecord -v -data - dev=/dev/scd0"

You can get both at

    http://www.serice.net/shunt/


Thanks,
Paul Serice


Reply to: