Get Firefox! Viewable with any browser! Valid HTML 4.01! Valid CSS! OpenOffice.org
Text size: 

CD Writing Howto

9) IF YOU'RE RUNNING LOW ON DISK SPACE...

Let's say your hard disk is getting pretty full and you want to back up some of the junk onto a CD and then delete it. The trouble is that you don't have enough room left for the ISO 9660 filesystem image generated by mkisofs on any single partition. Aside from the fact that you shouldn't get yourself into such a mess :o) you now have to face the real problem of not having enough disk space to perform the backup.

As is the case for most problems in Linux, there's a rather elegant solution.

The -o filename command line option for mkisofs dumps the resulting ISO filesystem image into a file called filename, but what happens if we don't use this option? Where does the output from mkisofs go? And if it isn't sent to a file on my disk how does cdrecord know what to write to the CD?

Without the -o filename option, mkisofs will send its output to the console. Now, cdrecord can also take its input from the console if we use a hyphen as the "file" to write to the CD. Much like this:

# cdrecord {options} -

Now we can pipe the output from mkisofs straight into cdrecord and the examples in the previous section could therefore all be concatenated into one command line (don't miss the hyphen at the end):

# mkisofs -J -r -V Session2 -C $(cdrecord dev=0,0 -msinfo) -M 0,0 /path/to/back/up | cdrecord dev=0,0 -v -eject speed=8 fs=16m -multi -

The command line may be looooooong, but you have to admire the power of command line tools. With this single command you have merged 2 tables of contents and written the next session to the CD while still retaining its multisession characteristics allowing you to add further sessions at a later date. I wonder how much futzing around with a mouse that would have taken...

The only downside to doing things this way is that you have to have a fast hard disk with an efficient filesystem. The alternative is to slow down the writing process.

Creating an ISO image file does make burning multiple copies of the CD more efficient. By piping mkisofs's output directly into cdrecord you are in effect generating the ISO image on the fly and not saving it anywhere, which means that it has to be generated once for each copy of your CD.

 

<< 8) Multisession CD-ROMs 10) Using audio tracks >>

Back to the howto title page
Back to howto-pages.org