Writing to cds with linux

Writing to CDs

Because the data written to a CD becomes permanent once it is written, you need to format the CD and copy files to it all in one step. If you formatted it first, you would end up with an empty file system on a CD that can no longer be written to.

The first step is to create an image of the CD file system as a file on your computer. You do this with the mkisofs command. As an example, imagine that you want to back up the home directory for user mary. You would invoke the mkisofs command and pass it the name of the file system image file to create, followed by the directory to base it on:

This creates an ISO9660 file system image in a file named mary.cd located in the /var/tmp directory. The -R option causes Linux-specific file ownership and long file names to be used. If your /var partition does not have enough room for the image, choose a different location.

Tip By default, mkisofs preserves the ownership and access rights of files and directories when it creates the file system image. This is appropriate when you are making a backup, but not when you are creating a software distribution CD. In such a case, add the -r option instead of -R as the first parameter to mkisofs. It will then store all files as publicly readable and, where appropriate, executable.

Before you can write this image file to a CD, you must first discover the SCSI bus number, device ID number, and Logical Unit Number (LUN) of the CD drive. Unless you have an actual SCSI bus in your computer, the emulated SCSI bus is probably numbered zero. You can find out which SCSI device ID the CD drive is using. Invoke the cdrecord command with the single parameter -scanbus:

Читайте также:  Установка linux mint uefi gpt

You should see a response similar to the following:

Cdrecord 2.0 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jorg Schilling Linux sg driver version: 3.1.25 Using libscg version ‘schily-0.7’ scsibus0:

This tells you that the CD drive is using SCSI ID zero. The Logical Unit Number in this case should always be zero, so you now have all three numbers. You supply them to cdrecord as part of the dev parameter. The SCSI bus number is listed first; it is followed by the ID number, and then by the LUN. The entire command should look similar to this:

# cdrecord -v speed=2 dev=0,0,0 -data /var/tmp/mary.cd

Several additional parameters are included in the command. The -v parameter tells cdrecord to supply verbose output to the screen. The speed parameter tells cdrecord what speed to record at (in this case X2). (You might choose to leave off speed=2 and let cdrecord autodetect the record speed of your CD burner.) The -data parameter tells cdrecord that the next parameter is the name of the file system image to write to the CD. (You can add the -eject to eject the CD when it is done.) As it works, cdrecord should display status messages that look similar to the following:

Cdrecord 2.0 (i686-pc-linux-gnu) Copyright (C) 1995-2002 Jörg Schilling

Linux sg driver version: 3.1.24

0, 0, 0 0, 0, 1 0, 0,2 0, 0,3 0, 0,4 0, 0,5 0, 0, 6 0, 0,7

0) ‘IDE-CD ‘ ‘R/RW 4x4x24 ‘ ‘1.04’ Removable CD-ROM

Using libscg version ‘schily-0.7’ atapi: 1

Device seems to be: Generic mmc CD-RW.

Читайте также:  Softether vpn for linux

Using generic SCSI-3/mmc CD-R driver (mmc_cdr).

Response Format Vendor_info Identifikation Revision

MMC SWABAUDIO TAO PACKET RAW/R16 1572864 = 1536 KB 4194304 = 4096 KB 322 MB 370 MB (36:43.12) = 370 MB (36:45/09) = 2048

165234 sectors 165234 sectors

Driver flags Supported modes: Drive buf size FIFO size Track 01: data Total size: Lout start: Current Secsize: ATIP info from disk:

Indicated writing power: 4 Is not unrestricted Is not erasable

Disk sub type: Medium Type A, high Beta category (A+) (3) ATIP start of lead in: -11849 (97:24/01) ATIP start of lead out: 359848 (79:59/73) Disk type: Long strategy type (Cyanine, AZ0 or similar) Manuf. index: 2 5

Manufacturer: Taiyo Yuden Company Limited

Blocks total: 359848 Blocks current: 359848 Blocks remaining: 194614 Starting to write CD/DVD at speed 2 in real TAO mode for single session. Last chance to quit, starting real write in 0 seconds. Operation starts. Waiting for reader process to fill input buffer . input buffer ready. Performing OPC. . . Starting new track at sector: 0

Track 01: 322 of 322 MB written (fifo 100%) [buf 99%] 2.0x.

Track 01: Total bytes read/written: 338395136/338395136 (165232 sectors)

Fixating time: 126.108s cdrecord: fifo had 5331 puts and 5331 gets.

cdrecord: fifo was 0 times empty and 5262 times full, min fill was 96%.

After cdrecord finishes writing the CD and your shell prompt returns, delete the file system image file /var/tmp/mary.cd. Label the CD appropriately and store it in a safe place.

If you need any files that were copied to the CD, just return the CD to the CD drive. If it doesn’t automatically open a window displaying the contents of the CD, type: mount /mnt/cdrom as root user. Open /mnt/cdrom in a folder window and copy the files you want.

Читайте также:  Lexmark drivers on linux

Cross-Reference See Chapter 8 for more information on cdrecord. You can also learn more about installing and troubleshooting writable CD drives from the CD-Writing-HOWTO. Or you can get a copy of the HOWTO by visiting the Linux Documentation Project Web site, www.tldp.org.

Related Posts

Источник

Оцените статью
Adblock
detector