Re: growisofs should have a method for padding
| From: D. Hugh Redelmeier <email@example.com>
| Date: Thu, 12 May 2005 01:26:13 -0400 (EDT)
| The 2.6 kernel's CD/DVD driver has the unfortunate propensity to read
| ahead past the end of a CD/DVD. It then reports an error, even if the
| actual read request was completely legitimate. See, for example,
| The conventional work-around is to always pad when writing a CD/DVD.
| Ugly, but true. (I agree that this isn't the correct fix, but the
| problem has not been fixed in a year, so it isn't going away soon.)
| See, for example,
The variant of cdrecord shipped in Fedora Core 3 is calls itself
Cdrecord-Clone 2.01-dvd. This burns coaster DVDs for me, but it does
have a nice --padsize option.
growisof does not have a --padsize option :-(
Since copying a .iso takes a lot of time and space, I wrote a script
to alter a .iso in place. It adds or removes padding in the amount I
think needed: 128k byes. With a padded .iso, I don't need the
================ isopad script ================
# isopad [+] [-] isofile...
# The Linux IDE CD driver in 2.6 tries to read ahead, even past the end of the
# CD or DVD. Even when the program issuing the original read request was only
# trying to read legitimate parts of the disc (albeit near the end).
# The result is spurious I/O errors and read failures.
# It does not seem that this driver bug is going to be fixed soon.
# This program is intended to facilitate a workaround. It can pad (or unpad)
# a .iso file so that, when it is burned, the resulting disc will allow
# reads past the end of the content to succeed.
# "+" means pad the following .iso files.
# "-" means remove all padding.
# neither means test file and iso sizes.
# To see how much readahead is enabled on a drive: hdparm -a /dev/hdc
# Why do the padding in place, rather than on a copy of the file?
# .iso files are usually quite large so copying takes a lot of time and space.
# Copyright 2005 D. Hugh Redelmeier
# License: GPL
# Version: Sat Jun 18 02:31:48 EDT 2005
# stop at the least sign of trouble
set -u -e
# op is "", "-", or "+": operation to be performed
echo "Usage: $0 [-|+|] isofile..."
isosize -x "$fn"
fsz=`stat --format='%s' "$fn"`
# conventional block size for CDs
# my guess at a sufficient amount of padding (in blocks)
if [ $fsz -lt $isz ]
echo "$fn is shorter ($fsz) than it should be ($isz)" >&2
elif [ ` expr $fsz % $bs ` -ne 0 ]
echo "$fn file size ($fsz) is not a multiple of $bs" >&2
elif [ ` expr $isz % $bs ` -ne 0 ]
echo "$fn isosize ($isz) is not a multiple of $bs" >&2
case "$op" in
if [ $fsz -eq $isz ]
echo "$fn: isosize == file size == $fsz"
echo "$fn: isosize $isz; file size $fsz"
echo "$fn: padding with $pb blocks of $bs zero bytes"
dd if=/dev/zero bs=$bs count=$pb >>"$fn"
if [ $fsz -eq $isz ]
echo "$fn: already $fsz bytes"
echo "$fn: truncating from $fsz to $isz bytes"
dd if=/dev/null of="$fn" seek=$isz bs=1
================ end ================