How to burn an ISO or NRG image to a DVD from the command line on Linux

Question: I need to burn an image file (.iso or .nrg) to a DVD using a DVD writer on my Linux box. Is there a quick and easy way, preferably using a command-line utility, to burn an .iso or .nrg image to a DVD?

The two most popular formats for image files are ISO (.iso file extension) and NRG (.nrg file extension). The ISO format is a global standard created by ISO (International Organization for Standardization), and therefore is supported natively by most operating systems, allowing a high level of portability. On the other hand, the NRG format is a proprietary format developed by Nero AG, a very popular disc imaging and burning software firm.

Here is how to burn an .iso or .nrg image to a DVD from the command line on Linux.

Convert an NRG Image to ISO Format

Due to ISO's widespread adoption, burning an .iso image to CD/DVD is straightforward. However, burning an .nrg image requires converting the image to .iso format first.

To convert an .nrg image file to .iso format, you can use nrg2iso, an open source program that converts images created by Nero Burning Rom to standard .iso (ISO9660) files.

To install nrg2iso on Debian and derivatives:

# aptitude install nrg2iso

To install nrg2iso on Red Hat-based distros:

# yum install nrg2iso

On CentOS/RHEL, you need to enable Repoforge repository before running yum.

Once the nrg2iso package has been installed, use the following command to convert an .nrg image file to .iso format:

# nrg2iso filename.nrg filename.iso

When conversion is complete, an .iso file will appear inside the current working directory:

Burn an .ISO Image File to a DVD

In order to burn an .iso image file to a DVD, we will use a tool called growisofs:

# growisofs -dvd-compat -speed=4 -Z /dev/dvd1=WindowsXPProfessionalSP3Original.iso

In the above command-line, the "-dvd-compat" option provides maximum media compatibility with DVD-ROM/-Video. In write-once DVD+R or DVD-R context, this results in unappendable recording (closed disk).

The "-Z /dev/dvd1=filename.iso" option indicates that we burn the .iso file to the media found in the selected device (/dev/dvd1).

The "-speed=N" parameter specifies a burning speed of a DVD burner, which is directly related to the capability of the drive itself. "-speed=8" will burn at 8x, "-speed=16" at 16x, and so on. Without this parameter, growisofs by default assumes the lowest speed available, which in this case happens to be 4x. You should choose the burning speed from the available speeds in your drive and the type of disks that you have.

You can find the device name of your DVD burner and its supported writing speed using this tutorial.

When the burning process has been completed, the disk should be automatically ejected from the tray.

Check the Integrity of a Burned Media

At this point, you can check the integrity of the burned media by comparing the md5 checksum of the original .iso file with the same checksum of the burned DVD. If both are identical, you can rest assured that the burning was successful.

However, in case you have converted an .nrg image to .iso using nrg2iso, you need to be aware that nrg2iso creates an .iso file whose size is not a multiple of 2048 (as ordinary .iso files are). Thus, an ordinary comparison between the checksum of this .iso file and the contents of the burned media will differ.

On the other hand, if you have burned an .iso image that does not come from an .nrg file, you can use the following command to check the integrity of the data recorded in a DVD. Replace "/dev/dvd1" with your own device name.

# md5sum filename.iso; dd if=/dev/dvd1 bs=2048 count=$(($(stat -c "%s" filename.iso) / 2048)) | md5sum

The first part of the command (up to the semicolon) calculates the md5 checksum of the .iso file, while the second part reads the contents of the disk present in /dev/dvd1, and pipes them into the md5sum tool. "bs=2048" indicates that dd will use a block sector of 2048 bytes as many times as the size of the original iso file divided by 2048.

If the two md5 checksum values are identical, it means that the burned media is valid.

Download this article as ad-free PDF (made possible by your kind donation): 
Download PDF

Subscribe to Ask Xmodulo

Do you want to receive Linux related questions & answers published at Ask Xmodulo? Enter your email address below, and we will deliver our Linux Q&A straight to your email box, for free. Delivery powered by Google Feedburner.

Support Xmodulo

Did you find this tutorial helpful? Then please be generous and support Xmodulo!

One thought on “How to burn an ISO or NRG image to a DVD from the command line on Linux

  1. Your method to check burned disc integrity is unnecessarily complicated. Here's a much easier method:

    1. Find the md5sum of the ISO image:
    $ md5sum /path/to/iso/image

    2. Find the exact size of the ISO image, in bytes:
    $ stat /path/to/iso/image

    3. Find the md5sum of the data on the disc:
    $ head -c [ISO image size in bytes] /dev/sr0 | md5sum

    4. Compare the two md5sums.

Leave a comment

Your email address will not be published. Required fields are marked *