Home / Alt manpages / xorrecord(1)

  • xorrecord(1)
  • User command
  • linux

Burn an ISO Image Safely with xorrecord

Optical media has no undo button, so xorrecord rewards checking the drive and image twice and burning once. You will write one ISO 9660 image to a CD, DVD or Blu-ray disc, catching the mistakes that matter before the laser does. The examples target the installed xorriso 1.5.6 package on GNU/Linux. Allow 10 to 20 minutes for preparation and a burn, plus time to verify the disc.

Before you start

You need the xorriso package, an accessible optical writer, suitable blank or appendable media, and an ISO image such as ./release.iso. The device must not be mounted or in use elsewhere. A normal user needs read and write permission for the optical device; use sudo only when your account lacks that, since running the whole burn as root can hide a permission problem rather than fix it.

Check the local version and the command's emulation mode first:

$ xorrecord --no_rc -version
$ xorrecord --no_rc -help

The version output should identify xorriso 1.5.6 on the system described here. --no_rc goes first deliberately: without it, xorrecord may read generic xorriso startup files from locations such as /etc/xorriso/xorriso.conf and $HOME/.xorrisorc, and those files can add commands you never put in the shell line.

1. Find the drive address

Put the blank or appendable disc in the drive, then ask xorrecord to list accessible MMC drives:

$ xorrecord --no_rc --devices

Look for a line containing an address such as /dev/sr0: that address is the value for dev=. A typical result looks like this:

0  -dev '/dev/sr0' rwrw-- : 'Vendor' 'Optical Writer'
  • No drives found? Check the cable or virtual machine pass-through, confirm the drive exists with ls -l /dev/sr*, and check your group or udev permissions.
  • Drive already mounted? Unmount its filesystem before using it. The device scan itself does not burn or alter media, so run it freely.

2. Inspect the drive and media

Replace /dev/sr0 below with the address you found. This reads drive and media information without supplying a track source:

$ xorrecord --no_rc dev=/dev/sr0 -inq -atip -toc

Use the output to confirm the writer, media type, whether the medium is erasable, and whether it is blank, closed or appendable. A blank write-once disc is fine for a new image. A closed disc cannot accept another session. Reusable CD-RW or DVD-RW media can be blanked, but that is itself a destructive operation.

3. Check the image before burning

Confirm the source exists and is a regular file. This catches a mistyped path before the drive even starts spinning:

$ test -f ./release.iso && ls -lh ./release.iso
$ file ./release.iso

The image should be described as an ISO 9660 filesystem, possibly with Rock Ridge or Joliet extensions. If file cannot read it, stop and repair or regenerate the image. A directory will not work as the track source: xorrecord accepts readable files and standard input, but not directories.

4. Run a cautious burn

This command writes one data track, pads it for compatibility, ejects the tray afterwards, and reports verbose progress. It also uses a fixed speed rather than the default maximum, which makes a marginal drive or disc much easier to diagnose:

$ xorrecord --no_rc -v dev=/dev/sr0 speed=4 fs=8m \
    blank=as_needed padsize=300k -eject ./release.iso

blank=as_needed only prepares a medium when its state permits it. It may blank reusable media, so check the -toc output first. It will not make a non-blank write-once disc safe, whatever you hope.

The default program FIFO is 4 MB; fs=8m gives a slower source more buffering, at the cost of memory and filesystem cache. A bare speed number like 4 is interpreted using the medium's unit, or give an explicit value such as 4d for 4x DVD or 4c for 4x CD.

Warning

There is no undo for a write to CD-R, DVD-R or BD-R. Testing a command? Use -dummy with supported rewritable or emulated media, but treat it as a check, not a guarantee: the manual warns dummy mode depends on the drive and medium combination. Do not add --drive_not_exclusive just to get past a busy-drive error either. It disables locking and can let a mount or another process interfere with the burn.

Checkpoint: confirm the burn

A successful run ends without a non-zero exit status and reports that the track and session finished. Check the status explicitly if the command was part of a script:

$ printf 'exit=%s\n' "$?"

After -eject, put the disc back in and ask xorrecord for its table of contents:

$ xorrecord --no_rc dev=/dev/sr0 -toc

For stronger verification, mount the reloaded disc read-only at a temporary mount point, list the expected files, then unmount it again. Mounting generally needs elevated privileges unless your desktop's automount policy handles it:

$ sudo mount -o ro /dev/sr0 /mnt
$ find /mnt -maxdepth 2 -type f | head
$ sudo umount /mnt

If the disc already mounted itself automatically, do not also issue the manual mount command against the same device. Contents differ from the source tree? Discard the burn and investigate the image or drive rather than trust a partial result.

Adding a second ISO session

Use -multi only when you deliberately want the medium to stay appendable. Skip it and a sequential disc closes after the session, unable to receive another one. DVD-R DL and DVD-RW blanked with blank=deformat_quickest cannot use this workflow either.

Create an image for the first session and burn it with -multi:

$ xorrisofs -o image-1.iso -J -graft-points /docs=./docs
$ xorrecord --no_rc -v dev=/dev/sr0 -multi \
    --grow_overwriteable_iso blank=as_needed \
    padsize=300k -eject image-1.iso

Before building the next image, get the two numbers xorrisofs -C needs. Reloading the tray can help the operating system notice the new session:

$ m=$(xorrecord --no_rc dev=/dev/sr0 -msinfo)
$ xorrisofs -M /dev/sr0 -C "$m" -o image-2.iso \
    -J -graft-points /photos=./photos
$ xorrecord --no_rc -v dev=/dev/sr0 -multi \
    --grow_overwriteable_iso -eject padsize=300k image-2.iso

--grow_overwriteable_iso extends the same ISO-style workflow to overwritable DVD or Blu-ray media. It implies -isosize, so the source must be an ISO 9660 image; it will not turn arbitrary files into sessions.

Common failures

  • Permission denied: grant your user the distribution's normal optical-device access, then log in again. Use sudo xorrecord --no_rc --devices only as a diagnostic comparison.
  • Device busy: unmount the disc and stop software that polls or writes to the drive. Keep exclusive locking enabled.
  • Track size is required: DVD-R DL and quickly de-formatted DVD-RW can need a known length. Use a regular image file, or provide the exact tsize= value; -isosize works only for an ISO 9660 source.
  • Buffer or speed problems: lower speed=, increase fs= moderately, and avoid very large FIFOs that starve the system's read cache. Old CD drives may still abort on temporary source delays.
  • Unexpected settings: put --no_rc first, or inspect the xorriso startup files before relying on a repeated command.

Done means

  • Version and drive checked: the installed version and drive address were confirmed first.
  • Image identified: the ISO was verified before the burn started.
  • Medium state understood: before any blanking option was used.
  • Burn verified: it exited successfully and the reloaded disc showed the expected files.
  • Disc state deliberate: unmounted cleanly, or kept appendable on purpose with -multi.