Linux/CD Burning
< Linux
Coasterless CD Burning
Installing Your ATAPI CDRW Drive in Linux
Accurately Reading a CD Device
Install mkisofs package:
yum install mkisofs
How to consistently read the correct number of blocks.
isoinfo -d -i /dev/cdrom
"Logical block size is: 2048" and "Volume size is: 329989"
dd if=/dev/cdrom of=image.iso bs=2048 count=329989 conv=notrunc,noerror
rawread script:
#!/bin/sh device=$1 blocksize=`isoinfo -d -i $device | grep "^Logical block size is:" | cut -d " " -f 5` if test "$blocksize" = ""; then echo catdevice FATAL ERROR: Blank blocksize >&2 exit fi blockcount=`isoinfo -d -i $device | grep "^Volume size is:" | cut -d " " -f 4` if test "$blockcount" = ""; then echo catdevice FATAL ERROR: Blank blockcount >&2 exit fi command="dd if=$device bs=$blocksize count=$blockcount conv=notrunc,noerror" echo "$command" >&2 $command
rawread /dev/cdrom > myiso.iso
rawread /dev/cdrom | md5sum
Writing a CD
Burn Ubuntu ISO:
cdrecord -v -dev /dev/cdrw ubuntu-18.04.3-server-amd64.iso
Report SCSI number of your CDRW:
cdrecord -scanbus cdrecord dev=ATA -scanbus
Blank CDRW:
cdrecord dev=0,0,0 speed=10 blank=fast padsize=63s -pad -dao -v -eject
Burn the CD from the ISO:
cdrecord dev=0,0,0 speed=10 padsize=63s -pad -dao -v -eject myimage.iso
Proper burning:
- Burn at the right speed
- Pad properly (padsize=63s and -pad)
- Use disk at once (-dao)
- Unless your burner prevents buffer underflow, do no other work while you're burning.
Make sure the CD is properly padded
cdrecord dev=0,0,0 speed=10 padsize=63s -pad -dao -v -eject /home/myuid/myiso.iso
Disk at Once
This argument helps clarify to CD readers where the last block is:
cdrecord dev=0,0,0 speed=10 padsize=63s -pad -dao -v -eject /home/myuid/myiso.iso
Summary
To burn a CD correctly, you must take care of the following:
- Set up your burner correctly.
- Burn at the right speed.
- While burning, do not perform other CPU or disk intensive work, as it will cause buffer underflow on burners without underflow protection.
- Always pad correctly with the padsize=63s and -pad argument to cdrecord. Without excellent reason, do not defeat the -pad default of the mkisofs program.
- Always use disk at once. In the cdrecord program, you signify disk at once (session at once) with -dao.
Testing a CD
md5sum myiso.iso rawread /dev/cdrom | md5sum
If they match, you've burned a winner.
Verifying an ISO
rawread /dev/cdrom > myiso.iso rawread /dev/cdrom | md5sum md5sum myiso.iso
CD Tools
cdrecord dev=/dev/cdrw padsize=63s -pad -dao -v -eject myimage.iso | Burn ISO image | |
mkisofs -J -l -r -o foo.iso /path/to/some/directory | Make ISO | |
cdrecord -dev=/dev/scd0 -speed=n -dao -pad -v foo.iso | Burn ISO image | |
gzip < /dev/cdrom > cdrom.iso.gz | Save copy of data cdrom | |
mkisofs -V LABEL -r dir | gzip > cdrom.iso.gz | Create cdrom image from contents of dir | |
mount -o loop cdrom.iso /mnt/dir | Mount the cdrom image at /mnt/dir (read only) | |
cdrecord -v dev=/dev/cdrom blank=fast | Clear a CDRW | |
gzip -dc cdrom.iso.gz | cdrecord -v dev=/dev/cdrom - | Burn cdrom image (use dev=ATAPI -scanbus to confirm dev) | |
cdparanoia -B | Rip audio tracks from CD to wav files in current dir | |
cdrecord -v dev=/dev/cdrom -audio *.wav | Make audio CD from all wavs in current dir (see also cdrdao) | |
oggenc --tracknum='track' track.cdda.wav -o 'track.ogg' | Make ogg file from wav file |
Mounting ISO Images
mount -o loop -t iso9660 <isofilename> <mountpoint>
mount /dev/cdrom /mnt/cdrom
Check if an old burned CD is still Good
CLI Magic: Is that CD still fresh?
cdck -i
Make an ISO Image
dd if=/dev/dvd of=dvd.iso # for dvd dd if=/dev/cdrom of=cd.iso # for cdrom dd if=/dev/scd0 of=cd.iso # if cdrom is scsi
mkisofs -RJ -o image.iso /burndirectory/ mkisofs -J -o image.iso /burndirectory dd if=/dev/cdrom of=image.iso cat /dev/cdrom >image.iso cdrecord -v dev=3,0,0 image.iso
mkdir /mnt/isotest mount -t iso9660 /dev/cdrom /mnt/isotest -o loop ls /mnt/isotest
# Setting up your system to work with cdrecord # append="hda=ide-scsi" cdrecord -scanbus
Command-line CD-ROM burning in Linux
mount -t iso9660 -o loop image.iso /mnt/isoimage umount /mnt/isoimage mkisofs -f -R -r -l -J -Vvolid -Aappid -Ppubid -odest.iso src
YoLinux Tutorial: Burning a CD or DVD
- LOTS of details
- Good Details
- Linux SCSI emulation adventures
- cd burning problem (forum)
- No CD-Recorder available... (thread)
cdrecord -v -tao -data speed=8 dev=/dev/hdc your_file.iso cdrecord -dev=ATA:1,0,0 Desktop/berry-0.72.iso cdrecord -dev=/dev/hdc Desktop/berry-0.72.iso
Notes
Linux 2.6 and the ide-scsi module
- Do not use the ide-scsi module any more