mkisofs -r /tmp/cddata | cdrecord -v fs=6m speed=4 dev=0,4,0 -
https://www.linux-magazine.com/issue/10/mkisofs_cdrecord.pdf
BURNING BY COMMAND CDs written fast on the command line
The graphical user interface may be the user friendly way of burning audio and data to disc, but for pure speed the command line simply can't be beaten.
It is also possible to burn a directory directly onto the CD, without taking up 650MB of disk space first. Output from mkisofs is simply transferred via a pipe to cdrecord; mkisofs is called up without specifying an output file (-o file) and simply writes the ISO image in the standard output:
mkisofs -r /tmp/cddata | cdrecord -v fs=6m speed=4 dev=0,4,0 -
The minus sign at the end of the command is necessary so that cdrecord reads the data from the standard input and does not attempt to read from a file.
A buffer of 6MB (option fs=6m) should prevent buffer underrun. But such buffer underruns (which result in the destruction of the blank) are highly unlikely under Linux anyway, as the operating system has a good multitasking function. Even with the most vigorous activities being performed by other programs, we have never known cdrecord to miss a stroke. In operating systems with less powerful multitasking, burnt out blanks are commonplace - even the screensaver kicking in can cause problems.
It is only on very low-powered or very heavily overloaded computers that this type of failure would be conceivable under Linux, and the industry has created a remedy for this scenario: devices with BURN-Proof technology reliably prevent buffer underruns. cdrecord supports this technology.
Since audio CDs do not contain a file system, mkisofs is not needed for them. The tracks are simply written one after another onto the CD. As with data CDs, cdrecord is used for the burn procedure, with a few modifications. The sample command from the start of the article now becomes
cdrecord -v -audio -pad dev=0,4,0 speed=4 /tmp/track*.wav
The dev and speed options have not been altered, but two new ones have been added:
-audio tells the burn software that an audio CD is to be burned.
-pad is less obvious. Audio CDs include tracks in accordance with the CD-DA (Compact-Disc Digital-Audio) standard, and tracks with this specification need a few special characteristics. They need a sampling rate of 44,100 samples per second and their file size must be a multiple of 2352 bytes. Since the wav or au files available for burning do not, as a rule, comply with this file size requirement, the -pad option is needed to add an appropriate number of zeros to the end of the file.
It is also possible to create audio CDs incrementally. The additional option -nofix is used to do so. The following three commands each burn two tracks onto the CD and only fix the blank on the third write procedure, thus finishing it off completely:
cdrecord -v -audio -pad -nofix dev=0,4,0 speed=4 t1.wav t2.wav cdrecord -v -audio -pad -nofix dev=0,4,0 speed=4 t3.wav t4.wav cdrecord -v -audio -pad dev=0,4,0 speed=4 t5.wav t6.wav
A CD which has not been fixed can only be played back in CD burners and not in simple CD- ROM drives or audio CD players. You can finish these discs off at any time using the -fix option:
cdrecord -v -fix dev=0,4,0
Sometimes the resultant CD is missing some audio tracks - with noise taking their place. This is due to the structure of your wav files - the byte sequence of the audio coding is wrong; The sequence can be Little Endian or Big Endian. To get rid of this very strange phenomenon (and to correct the byte sequence), use the -swab (SWAp Bytes) option.
LINUX MAGAZINE 10 - 2001
After it took me a day and reading 4 separate posts on cd burning, I finally got my ATAPI CD Writer working nicely by using scsi emulation. I thought I would post the steps I took to help out other CD burning dummies (like me).
cdrecord (and I presume other cdr tools for linux) want to use SCSI drivers. Why? I don't know. Most of us probably have ATAPI CD Writers, so we need to be able to emulate a SCSI CD Writer with our ATAPI CD Writer. Forunately, the kernel has modules that can do this for us. Unfortunately, the kernel isn't set up properly by default.
I used cdrecord to test and see if my CD writer could be detected. (emerge cdrtools)
I am running on i686 compatible architecture with the gentoo-sources-2.4.20-r5 kernel. EDIT: If you are using a 2.6.x kernel or newer, there is probably a better way than scsi emulation.
I have an ATAPI CD writer whose cables and jumpers are properly connected.
Check if cdrecord —scanbus shows your ATAPI CD writer. If it does, then you are all set. Skip to the last step. (You might need to emerge cdrtools to get cdrecord)
If your CD writer doesn't show up, do lsmod and see if both ide-scsi and ide-cd show up.
EDIT: 2a. Also, make sure to add a kernel option hdX=ide-scsi for every CD drive you want to use, where X is the letter of your drive. You can find out what letter corresponds to your drives by examining the output of
dmesg | grep hd
Here's my kernel section (hdc is my writer and hdd is my reader):
title Gentoo Linux CD Burning root (hd0,1) kernel (hd0,1)/bzImage.cd_record ro root=/dev/hda5 vga=795 hdc=ide-scsi hdd=scsi-hdd
If the modules from part 2 do show up (or if you can modprobe them) and you have booted with the kernel options from part 2a, but cdrecord —scanbus still doesn't show your drives, use rmmod (module name) and modprobe (module name) to get the ide-scsi module loaded below the ide-cd module (below meaning it shows up below the other when doing lsmod).
If they don't show up and you can't modprobe the modules in, then you need to recompile your kernel (see x86 installation guide if you don't know how) using (at least) the following options:
ATA/IDE/MFM/RLL support -> IDE, ATA, and ATAPI Block Devices -> <M> SCSI Emulation Support SCSI support -> <M> SCSI support SCSI support -> <M> SCSI CDROM support SCSI support -> <M> SCSI generic support
It is important that all these options are selected as modules, because they probably won't be loaded in the right order by default regardless of whether they are 'compiled in' or 'compiled as modules.' Compiling them as modules makes it so you can have some level of control over how and when they are loaded. With these all selected as modules, you should be able to use most Linux CD recording tools that rely on SCSI drivers or SCSI emulation drivers. In other words, now you will be able tell linux to pretend that your ATAPI CD writer is a SCSI CD writer.
Recompile the kernel (see the x86 installation guide or somewhere else for more info on kernel stuff): make dep && make clean bzImage modules modules_install
Make sure that your boot partition is mounted, then cp /usr/src/linux/arch/i386/boot/bzImage /boot/(pick a name for your kernel)
edit /boot/grub/grub.conf (or whatever boot loader you use) to reflect the changes. (you remembered the kernel options from part 2a, right?)
reboot
Go repeat steps 1, 2 and 3 until the CD writer shows up.
To get it to work automatically on boot up, I added ide-scsi to /etc/modules.autoload, which makes it appear below ide-cd automatically on boot up.
Once it shows up, you can use cdrecord from the command line (you are on your own there), or, if you like nice GUI programs I highly recommend using k3b (emerge k3b), for KDE. It is very similar to CD Recording programs that you would find on Windoze from companies with funny names like Roxio or Nero.
Happy Burning!
Last edited by peaceful on Tue Nov 04, 2003
I had the same problems as everyone else it seems.. Here are some snippits from my config files that finally made it work.. One note though be sure to run k3bsetup as root to apply the correct permissions to the devices and binaries… This worked for me when nothing else did, now I can burn CD's as a "normal" user.
From /etc/lilo.conf
image = /boot/kernel-2.4.22-ac1 label = Gentoo read-only initrd=/boot/initrd-2.4.22-ac1 append="root=/dev/hde5 init=/linuxrc hda=scsi hdb=scsi"
## Where hda and hdb are my ATAPI CD devices(replace with yours), I happen to have a IDE Raid controller so my hard drives are actually hde and hdf
From /etc/modules.conf
### modules-update: start processing /etc/modules.d/cdr options ide-cd ignore='hda hdb'
### Ignores ATAPI devices hda and hdb ### modules-update: end processing /etc/modules.d/cdr
From /etc/modules.autoload.d/kernel-2.4
probeall scsi_hostadapter ide-scsi ataraid
With kernel 2.6 coming, this info will become (eventually) obselete…
With only ATAPI CDROM compiled into the kernel, you just:
cdrecord dev="/dev/hda" -scanbus
Also, shouldn't this go into documentation/tips&tricks?