Click to See Complete Forum and Search --> : cdrecord, How to


StanLin
12-25-2000, 11:54 AM
I am having a CDRW and running Red Hat 7. I can access the CDRW by just invoking:

mount /mnt/cdrom

Now, supposing I have a file called example.txt in the /home directory, please tell me the cdrecord command to burn it in the disc.

I have looked at the man page for cdrecord but it is just beyond me.

pbharris
12-25-2000, 12:48 PM
I don't know how to use cdrecord from the CLI... just typing cdrecord gave me s unch of options....

Hello,

here is my canned response:
typically there is no need to compile kernel (every distribution I have used has the modules already installed, these are RedHat, Slackware and Debian) , just load proper modules, edit your lilo.conf file. here is how i did it. any atapi/mmc compliant cdrw should work.I have one cdrom (hdc), one cd writer (the hp 8100, aka hdd). i use xcdroast for toasting software. I use hdc to rip music, to do this with xcdroast scsi emulation needs to be on for it too, if the drive is atapi/mmc compliant then no probl
ems. i could use the burner to rip music, but it is slower and much more expensive than the plain old cd-rom.

1. edit lilo.conf add (or edit) line so it says append=" hdc=ide-scsi hdd=ide-scsi" this needs to be done in the section under
image=/boot/vlinuz

2. in /dev/ delete any linck to cdrom and create links to the drives files (which will be scsi) i.e. rm /dev/cdrom

ln -s /dev/scd0 /dev/cdrom1
ln -s /dev/scd1 /dev/cdrom2

3. run /sbin/lilo

4. install xcdroast

5. reboot.

6. insert modules for scsi emulation. These are ide-scsi and sg.

insmod ide-scsi
insmod sg

7. use xcdroast setup program and burn CDs.


------------------
I don't use Linux because I hate Windows (which I do) I use Linux because I like it.
pbharris_359@yahoo.com

[This message has been edited by pbharris (edited 25 December 2000).]

H. M. Murdock
12-25-2000, 01:41 PM
Hi,

I was having the same basic problems a while ago and someone on this board sen me this file. I cant remember who it was, but it really helped. Here it is:


Learn how to configure your CD-Writer and write CDs on a Linux machine

Mrinal KalalKrishnan


Monday, June 19, 2000


Have you ever booted into Windows from Linux just to write a CD because =
you didn't know how to do that in Linux? You no longer need to do =
that. This article will walk you through CD writing under Linux.

If you own a SCSI CD-Writer, you don't need to recompile the kernel, =
and you can skip this section. If you have an IDE/ATAPI CD-writer =
(which is most probable), you'll have to make it appear like a SCSI =
device to the CD-writing applications. The Linux kernel has a "SCSI =
host adapter emulation" module, which does this. But if you don't =
want to mess around with kernel configuration, you're in luck. PC =
Quest has provided a kernel RPM in this month's CD, which has the =
IDE-SCSI module (which is used for SCSI emulation) in it, so all you =
have to do is install the RPM.

Before you begin, please note that you have to be root before you can =
perform any of these tasks. It's still a good idea to work as a user =
though, and then use the command "su" to become root.

Mount the CD (mount /mnt/cdrom) and then install the RPM with the =
command:

# rpm -ivh --force =
/pcq/goodies/kernel/kernel-2.2.14-12-cdwriting.i686.rpm

Now, you have to run LILO to update the boot record. You can do that by =
typing "lilo -v". Note carefully if there were any errors, then just =
reboot, and you'll be running off the new kernel with the IDE-SCSI =
module. The module is not in memory by default. To load the module, =
type "modprobe ide-scsi". If you have two CD-ROM drives, the first one =
will become /dev/scd0, and the second one /dev/scd1. To get back the =
normal IDE behavior (/dev/hd?), remove the ide-scsi module with the =
command "rmmod ide-scsi", and load the IDE-CD module with "modprobe =
ide-cd". By default, if you mount a CD with "mount/mnt/cdrom", it will =
autoload the IDE-CD module. So, in order to use the SCSI emulation, =
you'll have to remove the IDE-CD module first and then load the =
IDE-SCSI module with "rmmod ide-cd; modprobe ide-scsi".

If you want the normal IDE behavior for your CD-ROM drive and SCSI =
emulation only for your CD-Writer, then add the following line in =
/etc/conf.modules:

options ide-cd ignore=hdd

This makes the IDE-CD module ignore your CD-writer (assuming that it is =
/dev/hdd). Load the IDE-CD module first, followed by the IDE-SCSI =
module. You can also load the modules at boot time by adding the =
following two commands in /etc/rc.d/rc.sysinit:

action "Loading ide-cd module" modprobe ide-cd

action "Loading ide-scsi module" modprobe ide-scsi

The program you'll use to write CDs is called cdrecord, a =
command-line program. To test if the kernel module is working fine, and =
if cdrecord can actually find your CD-Writer, type "cdrecord-scanbus". =
You should get an output that contains the name of your CD-writer, =
something like this:

Cdrecord release 1.8a29 Copyright (C) 1995-1999 J=F6rg Schilling

Using libscg version "schily-0.1"

scsibus0:

0,0,0 0) =91PHILIPS =91 =91CDD3610 CD-R/RW =91 =913.01' Removable =
CD-ROM

0,1,0 1) *

0,2,0 2) *

0,3,0 3) *

0,4,0 4) *

0,5,0 5) *

0,6,0 6) *

0,7,0 7) *

Make a note of the three numbers next to the name of the CD-Writer (in =
this case - 0,0,0). These are the SCSI host, id and lun. You have to =
give these as parameters to cdrecord while writing the CD.

Making the CD image
To write a data CD, you have to first create an ISO9660 image. You =
would normally use the mkisofs program to do this. First, create a =
directory (say mycd), and copy all the files you want on your CD to =
that directory. Then, use mkisofs to generate the CD image.

# mkisofs -r -o cd_image mycd/

The -o option specifies that the CD image be written to the file =
cd_image. The -r option makes mkisofs generate Rock Ridge directory =
records for long file names. Change it to -J to generate Joliet =
directory records (which is useful if you want to read long filenames =
under Windows). And the last parameter is the directory to take as =
input to make the CD image.

Instead of copying all the files to your mycd directory, you can create =
symbolic links. This will save you a lot of hard disk space. Let's =
say you want to create a copy of the Linux source on the CD. Go to the =
mycd directory, and type in:

# ln -s /usr/src/linux.

To create CD images of directories that have symbolic links in them, =
you have to use the -f option with mkisofs, which makes it follow =
symbolic links.

Writing the CD

Now that you have the ISO9660 CD image ready, you can write the CD with =
a simple command:

# cdrecord -v dev=0,0,0 speed=2 cd_image

Change the three numbers to your SCSI host, id, and lun, (which you =
found out earlier with the cdrecord -scanbus command). Of course, set =
speed=x to the appropriate writing speed of your drive. The -v flag =
makes the output of cdrecord verbose, so that you can see a progress =
indicator. In case you want to have a dummy run before you actually =
write to a CD, add the -dummy flag.

Writing an audio CD

If you have WAV files of the audio tracks you want to put on the CD, =
just run cdrecord like this:

# cdrecord -v dev=0,0,0 speed=2 -audio track1.wav track2.wav...

The -audio flag specifies that the following tracks are all audio =
tracks. You can omit this flag, because cdrecord will detect the type =
of track depending on the extension.

You can also make a mixed-mode CD by specifying data tracks and audio =
tracks like this:

# cdrecord -v dev=0,0,0 speed=2 -data cd_image -audio track1.wav =
track2.wav...

To create WAV files from your audio CD, you'll need one of the many =
freely-available cD rippers, such as cdparanoia (see = www.xiph.org/paranoia). (http://www.xiph.org/paranoia).)

Making a one-to-one copy of a CD

To make a one-to-one copy of a data CD, you don't need to create an =
image using mkisofs. If you have two different drives, you can read the =
data stream directly from the device and use it as the input for =
cdrecord

# cdrecord -v dev=0,0,0 speed=2 -isosize /dev/cdrom

Change "/dev/cdrom" to the CD-ROM device which contains the original =
CD. Since this is a bit risky, a safer way is write out the original CD =
image into a file first, using dd:

# dd if=/dev/cdrom of=cd_image

This copies the ISO image into a file called "cd_image". Then you can =
write this image in the way described earlier.

Note that this method can't be used for audio CDs. You'll have to =
use cdda2wav or cdparanoia to rip the audio tracks from the CD into WAV =
files and then write it.

Multi-session CDs
The -multi option should be used for cdrecord if you want to be able to =
add further sessions to the CD. The image of the first session is =
created in the same way, the only extra thing being the -multi option. =
The subsequent images are a bit more complex to generate. Put the CD-R =
in the writer, and type in:

# mkisofs -r -o cd_image_2 -C $(cdrecord -msinfo dev=0,0,0) -M =
/dev/scd0 mycd/

The parameter to the -C option of mkisofs in the above example is the =
output of the command "cdrecord -msinfo dev=0,0,0", which returns =
multi-session information about the CD-R. This is required so that =
mkisofs knows where exactly the free space on the CD-R begins. The -M =
option takes the existing ISO 9660 image to which the new session is to =
be merged.

After creating the image, write it to the CD in the same way, making =
sure to use the -multi option if you need to add further sessions.

Writing on the fly

If you have a fast enough system, you can write CDs on the fly without =
creating a CD image on the hard disk. The trick is to pipe the output =
of mkisofs into cdrecord:

# mkisofs -r mycd/ | cdrecord -v dev=0,0,0 speed=2 -data -

Since the -o option is not given to mkisofs, it outputs the image to =
stdout. And cdrecord takes the input image from stdin because the data =
track is specified as "-". You may want to do a dummy run with the =
-dummy flag before actually writing a CD on the fly.

Writing CD-RWs

Writing to a CD-RW is exactly the same as writing to a CD-R. The only =
thing you need to know is how to blank the CD-RW. Type in "cdrecord =
dev=0,0,0 blank=help" to find out the different blanking types =
available. To do a quick blank, type:

# cdrecord -v speed=2 dev=0,0,0 blank=fast

There are various GUI programs available that act as a front end to =
mkisofs and cdrecord, making the process simpler. You can get XCDRoast =
from www.xcdroast.org (http://www.xcdroast.org) and GNOMEToaster from = http://gnometoaster.rulez.org. There is a huge list of other GUI =
CD-writing programs available at = http://freshmeat.net/appindex/x11/cd%20writing%20 software.html.

To learn more about advanced CD writing, the CD-Writing-HOWTO is your =
friend. It's located in /usr/doc/HOWTO/CD-Writing-HOWTO on Red Hat =
systems. The manual pages of cdrecord and mkisofs may also come in =
handy. Type in "man mkisofs" and "man cdrecord" to access them.

Linux is an extremely stable platform for writing CDs. You can do =
almost anything while writing the CDs, without worrying about buffer =
under-runs and getting a shiny new coaster for your dinner table. =
I've even recompiled my kernel without any problems while writing a =
CD.

Happy trouble-free CD writing with Linux.


I don't know about gtoaster but if you want to do it in X-CD-Roast...
Click on Setup

CD-Writer-Device: Yamaha CRW8424S (put yours here) CD-Writer-Mode: =
Autodetect
CD-Writer Speed: I don't select any.

Data-Read-device: Teac CD-ROM CD532S (put yours here) =
Audio-Read-device:Teac CD-ROM CD532S (put yours here) Audio-Read-Mode: =
Autodetect
Audio-Read-Speed: Default

Under HD Setup, set Image Data Path to the location of your .iso file. =
Mine is at /shares/iso/ and i make that the Default.

Under Misc. the selections are: Internal Speaker, Never, None, Never =
and Never.

Under Defaults the selections are: Eject, Extended, Skip and Seconds.

Click on Save, OK then Done.

Click on Master CD
Fill in Directory with data to master: (Mine is /shares/iso/) Click on =
Write Image
Set Speed (Mine is 8)
Fill in Write from: file (ie: mandrake71-inst.iso) Click on Start Write =
Image and follow your nose until the disk is ejected. You are done.


I hope this helps.

Murdock

------------------
In 1972, a crack commando unit was sent to prison by a military court for a crime they didn't commit. These men promptly escaped from a maximum security stockade to the Los Angeles underground. Today, still wanted by the government, they survive as soldiers of fortune. If you have a problem, if no one else can help, and if you can find them, maybe you can hire the A-Team.

cs25x
12-25-2000, 03:09 PM
The only thing that can be added to that is that it is a good idea to drop your most used sequences into a script or two.
# BURNCD
#! /bin/bash
DEVICE="-dev=0,0,0"
BUFFER="-fs=32000000"
SPEED="-speed=8"
cdrecord $DEVICE $SPEED $BUFFER $1
echo -e -n \\a
sleep 1
echo -e -n \\a


# WIPECD
#!/bin/bash
DEVICE="-dev=0,0,0"
SPEED="-speed=8"
cdrecord $DEVICE $SPEED -blank=fast
echo -e -n \\a
sleep 1
echo -e -n \\a

0000000000000000000000000000000000000000

StanLin
12-26-2000, 02:32 AM
Thanks guys.

To pbHarris, I have done most of that setting up hardware stuff. To Murdock, those steps and commands were what I needed.

You cannot imagined how relieved I am to get the CDRW working.

AE
08-14-2001, 12:30 PM
Wow!
BIG thanks Howlin Mad Murdock!
That was a, just the way I want it, guide, too bad I can't give you more than five stars... One more question for this guru, or any one else that knows: When doing multisession, is it possible to exclude some files from a previous session? Thanx