1. Overview

An ISO file comprises data, a file system, and a directory structure organized in sectors. Usually, ISO files are a copy of a CD, DVD, or Blu-ray disk for operating systems and other software. An ISO file is also known as an ISO image.

In this tutorial, we’ll learn how to burn an ISO file to a CD or DVD in the Linux terminal using two commands:

We’ll install them, explore how they work, and burn an optical disk with each.

2. Optical Disk Drive and Burn Support

The first step in burning ISO files to a CD or DVD is to locate the optical disk drive’s path. Also, we might need to make sure the system supports CD or DVD burning.

2.1. /proc

First, using the /proc directory and the cat command, let’s check if our system supports CD or DVD burning:

$ cat /proc/sys/dev/cdrom/info

CD-ROM information, Id: cdrom.c 3.20 2003/12/17

drive name: sr0
drive speed: 24
...
Can play audio: 1
Can write CD-R: 1
Can write CD-RW: 1
Can read DVD: 1
Can write DVD-R: 1
Can write DVD-RAM: 1
Can read MRW: 1
Can write MRW: 1
Can write RAM: 1

Specifically, our attention falls on Can write DVD-R in the command’s output. The system supports DVD writing if the value is 1. Thus, the system ought to contain at least one piece of hardware that can write DVDs.

Notably, the drive name supporting the DVD write is sr0, hence, the full path to the DVD writer is /dev/sr0.

2.2. lsblk

Alternatively, we can check where our DVD writer is located using the lsblk command:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
...
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0     1M  0 part 
├─sda2   8:2    0   513M  0 part /boot/efi
└─sda3   8:3    0 465.3G  0 part /
sr0     11:0    1     0B  0 rom  

Here, the output highlights the presence of our target, sr0 with 0B showing that the DVD is blank. Also, we use this step to examine if we have more than one DVD device on our system.

2.3. lsscsi

However, we can also opt for the lsscsi command, which uses information in the Linux kernel to list SCSI and NVMe devices attached to a system:

$ lsscsi
[0:0:0:0]    disk    ATA      WDC WD5000AAKX-6 1H16  /dev/sda 
[1:0:0:0]    cd/dvd  TSSTcorp DVD+-RW SN-208BB D300  /dev/sr0

From the output, we can identify the type of disk drive we have. Specifically, DVD+-RW indicates a readable and writable DVD disk.

3. Using the wodim Command

wodim is the main tool provided by the cdrkit project for writing data to optical media like CDs and DVDs. wodim replaced cdrecord in many Linux distributions as the default command-line tool for burning optical discs.

Initially, cdrecord was part of the cdrtools package and was widely used for burning discs. However, due to licensing concerns surrounding cdrtools, the cdrecord tool was replaced by wodim. Thus, we’ll use the wodim command to burn a DVD ISO from the Linux terminal.

3.1. Installing wodim

Of course, to burn an ISO file using the wodim tool, we must first have the command on the system**.** Specifically, we can install wodim in Ubuntu using apt:

$ sudo apt install wodim

Further, we can check the read and write capabilities of our disk drive with wodim using the -prcap flag:

$ wodim -prcap
Device was not specified. Trying to find an appropriate drive...
Detected CD-R drive: /dev/sr0
Using /dev/cdrom of unknown capabilities
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   : 
Vendor_info    : 'TSSTcorp'
Identification : 'DVD+-RW SN-208BB'
Revision       : 'D300'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.

Drive capabilities, per MMC-3 page 2A:

  Does read CD-R media
  Does write CD-R media
  Does read CD-RW media
  Does write CD-RW media
  Does read DVD-ROM media
  Does read DVD-R media
  Does write DVD-R media
  Does read DVD-RAM media
  Does write DVD-RAM media
  Does support test writing
...

Here, the -prcap flag prints the disk drive’s capabilities for SCSI-3 MMC-compliant drives. SCSI-3 MMC stands for SCSI-3 Multimedia Commands, a set of command standards that specifically focuses on controlling and managing multimedia devices, such as CD and DVD drives, within a computing environment.

Since we didn’t specify any device for the command, it searches through the system for a CD or DVD drive. Then, once it finds any device, the command prints its properties and capabilities.

Alternatively, this serves as another way to check where our DVD writer is located.

3.2. Burning an ISO Image

Having confirmed the readiness of our system and the DVD drive, let’s burn the ISO to DVD using the wodim command:

$ wodim -eject -tao speed=2 dev=/dev/sr0 -v -data myiso.iso
TOC Type: 1 = CD-ROM
scsidev: '/dev/sr0'
devname: '/dev/sr0'
scsibus: -2 target: -2 lun: -2
...
Track 01: Total bytes read/written: 3826831360/3826831360 (1868570 sectors).
Writing  time:  857.908s
Average write speed   3.3x.
Min drive buffer fill was 99%
Fixating...
Fixating time:   26.991s
wodim: fifo had 60277 puts and 60277 gets.
wodim: fifo was 0 times empty and 41284 times full, min fill was 94%.

Let’s break down this command:

  • -eject ensures that once the burning process is complete, the DVD will be ejected automatically
  • -tao allows us to track the process in a Track-At-Once writing mode
  • dev=/dev/sr0 specifies the device file for the DVD drive
  • speed=2 sets the burning speed to 2
  • -v (verbose) enables us to track the recording progress
  • -data indicates that we’re writing data to the DVD

However, if the DVD writing fails, we can try a slower speed to see whether that fixes the problem. In fact, we can choose the slowest burn speed that is practically feasible for the lowest chance of an error.

Further, to see if the burning process was successful, we can check the DVD using the lsblk command:

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
...
sda      8:0    0 465.8G  0 disk 
├─sda1   8:1    0     1M  0 part 
├─sda2   8:2    0   513M  0 part /boot/efi
└─sda3   8:3    0 465.3G  0 part /
sr0     11:0    1   3.6G  0 rom  /media/user/Ubuntu 22.04.1 LTS amd64

The result, sr0 11:0 1 3.6G 0 rom /media/user/Ubuntu 22.04.1 LTS amd64, indicates that the DVD now contains 3.6G of data and now has the name of the ISO image burned on it.

Next, let’s look at how to use the growisofs command to achieve the same.

4. Using growisofs

The growisofs command is a frontend command-line tool for genisoimage that also serves as an optical disk recording program. Thus, we can use it to burn an ISO to a DVD.

Similar to wodim, we can install growisofs using apt:

$ sudo apt install growisofs

Now, we can explore how to burn an ISO image to DVD using growisofs:

$ growisofs -Z /dev/sr0=/path/to/iso_file

Let’s break down the command:

  • -Z indicates that we want to write the ISO to the disk
  • /dev/sr0 is the DVD drive’s device name
  • /path/to/iso_file is the path to the ISO file

For example, let’s burn the Ubuntu.iso image located in a user’s Download directory:

$ growisofs -Z /dev/sr0=/home/user_1/Downloads/Ubuntu.iso
Executing 'builtin_dd if=/home/user/ubuntu.iso of=/dev/sr0 obs=32k seek=0'
/dev/sr0: "Current Write Speed" is 8.2x1352KBps.
          0/3826831360 ( 0.0%) @0x, remaining ??:?? RBU 100.0% UBU   0.0%
   20971520/3826831360 ( 0.5%) @3.5x, remaining 69:33 RBU 100.0% UBU  99.7%
...
  277544960/3826831360 ( 99.7%) @3.9x, remaining 0:03 RBU 13.4% UBU  32.4%
  294879232/3826831360 ( 99.9%) @3.8x, remaining 0:01 RBU 7.2% UBU  40.1%
builtin_dd: 1379040*2KB out @ average 1.6x1352KBps 
/dev/sr0: flushing cache
/dev/sr0: closing track
/dev/sr0: closing disc
/dev/sr0: reloading tray

On pressing the Return key, the burning process will start displaying its progress in the terminal. Notably, when the process is done, the DVD ejects automatically.

5. Conclusion

In this article, we saw how to burn an ISO file to a CD or DVD in the Linux terminal using two commands.

First, we burned an ISO image to a DVD using the wodim command. After that, we did the same using the growisofs command.