How to Burn a Bootable ISO Image to Disc in a Linux Terminal:
There are many good free GUI apps to burn bootable linux iso images to disc in linux like k3b, brasero, xfburn and even the many free GUI burner apps for windows such as CdBurnerXP, ImgBurn, Infrarecorder, Active ISO Burner, BurnCDCC, Free ISO Burner, ISOBurn, ISO Recorder, Passcape ISO Burner, ISO Workshop, Free Any Burn, Windows 7 Built-in Disc Image Burner etc etc, and even free linux CLI apps like cdrecord and many others, in this article however I will just mention 3 quick command line apps that are most common in linux distributions and mention an extra 4th choice, thats a menu driven linux CLI burning app for last
In the examples used here the default internal burner of the laptop is set as /dev/sr0, If your burner is not /dev/sr0, replace the device with the one your system uses.
Insert your blank CD/DVD/BD-R/RW then choose a method below
1.) wodim, issue command at terminal:
# wodim -v -eject -data -dao dev=/dev/sr0 speed=4 /path-to-bootable-linux-iso/foo.iso
- It is recommended to run wodim as root even if you can run it as a normal user to avoid errors and instability, read more about it in the notes below, and check the link provided there for further reading.
- For choosing Write Modes use DAO as primary choice or as a secondary choice use SAO for burning bootable ISO to disc, when using wodim anyways if you issue -dao as an option and for some reason its not possible to use DAO, wodim will automatically switch to using SAO, so to be safe just use the option DAO as -dao
- For wodim if the typical format of /dev/<foo> (/dev/sr0 here), doesnt work, issue the command:
# wodim --devices
- A sample output of a laptop say for example with an internal DVD writer and another external USB DVD Writer drive plugged in will show:
wodim: Overview of accessible drives (2 found) :
-------------------------------------------------------------------------
0 dev='/dev/sg1' rwrw-- : 'HL-DT-ST' 'DVDRAM GUD0N'
1 dev='/dev/sg4' rwrw-- : 'Optiarc' 'DVD RW AD-7560S'
-------------------------------------------------------------------------
- Note how /dev/sr0 is referenced as /dev/sg1 with wodim and /dev/sr1 referenced as /dev/sg4 with wodim, but when you use lsblk command the output would show:
sr0 11:0 1 20.5M 0 rom
sr1 11:1 1 1024M 0 rom
- Both devices as /dev/sr0 as the internal laptop dvd writer and /dev/sr1 as the 2nd burner device as a usb plugged in external dvd writer
- So in this case if you want to use sr0 or sr1 devices for burning you can try:
(1st device, /dev/sr0)
# wodim -v -eject -data -dao dev=/dev/sg1 speed=4 /path-to-bootable-linux-iso/foo.iso
/or
(2nd device, /dev/sr1)
# wodim -v -eject -data -dao dev=/dev/sg4 speed=4 /path-to-bootable-linux-iso/foo.iso
- A sample verbose output of a successful DVD iso burn with wodim in terminal, using a gentoo linux live iso for example:
# wodim -v -eject -data -dao dev=/dev/sg1 speed=4 /home/lowfatdaemon/Downloads/Gentoo/livedvd-amd64-multilib-20160514.iso
TOC Type: 1 = CD-ROM
scsidev: '/dev/sg1'
devname: '/dev/sg1'
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.36
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type : Removable CD-ROM
Version : 5
Response Format: 2
Capabilities :
Vendor_info : 'HL-DT-ST'
Identification : 'DVDRAM GUD0N '
Revision : '1.00'
Device seems to be: Generic mmc2 DVD-R/DVD-RW.
Current: 0x0011 (DVD-R sequential recording)
Profile: 0x0012 (DVD-RAM)
Profile: 0x002B (DVD+R/DL)
Profile: 0x001B (DVD+R)
Profile: 0x001A (DVD+RW)
Profile: 0x0016 (DVD-R/DL layer jump recording)
Profile: 0x0015 (DVD-R/DL sequential recording)
Profile: 0x0014 (DVD-RW sequential recording)
Profile: 0x0013 (DVD-RW restricted overwrite)
Profile: 0x0011 (DVD-R sequential recording) (current)
Profile: 0x0010 (DVD-ROM)
Profile: 0x000A (CD-RW)
Profile: 0x0009 (CD-R)
Profile: 0x0008 (CD-ROM)
Profile: 0x0002 (Removable disk)
Using generic SCSI-3/mmc DVD-R(W) driver (mmc_mdvd).
Driver flags : SWABAUDIO BURNFREE
Supported modes: PACKET SAO
Drive buf size : 294912 = 288 KB
Beginning DMA speed test. Set CDR_NODMATEST environment variable if device
communication breaks or freezes immediately after that.
FIFO size : 12582912 = 12288 KB
Track 01: data 2839 MB
Total size: 3261 MB (323:05.10) = 1453883 sectors
Lout start: 3261 MB (323:07/08) = 1453883 sectors
Current Secsize: 2048
HINT: use dvd+rw-mediainfo from dvd+rw-tools for information extraction.
Blocks total: 2298496 Blocks current: 2298496 Blocks remaining: 844613
Speed set to 5540 KB/s
Starting to write CD/DVD at speed 4.0 in real SAO mode for single session.
Last chance to quit, starting real write in 0 seconds. Operation starts.
Waiting for reader process to fill input buffer ... input buffer ready.
Performing OPC...
Sending CUE sheet...
Starting new track at sector: 0
Track 01: 2839 of 2839 MB written (fifo 100%) [buf 60%] 3.9x.
WARNING: padding up to secsize.
Track 01: Total bytes read/written: 2977551360/2977552384 (1453883 sectors).
Writing time: 594.333s
Average write speed 3.7x.
Min drive buffer fill was 55%
Fixating...
Fixating time: 35.103s
wodim: fifo had 46900 puts and 46900 gets.
wodim: fifo was 0 times empty and 26857 times full, min fill was 97%.
- Upon finishing the burning process, with the command using the option -eject, the system will automatically eject the disc, so you know its done.
- The successful iso burn result, was a bootable gentoo live DVD disc.
Troubleshooting Wodim:
- If command "wodim --devices" doesnt work or you get some error (being root), you can also try one of the following:
# wodim -scanbus
or
# wodim dev=help --devices
- If you get issues or an error saying: cannot open SCSI driver, try using the command lsblk, and look for the corresponding rom devices, if you see sr(n) where n is a number like for example sr0 listed as rom, if so then, try using these commands:
# wodim dev=/dev/sr0 --devices
or
# wodim dev=/dev/sr0 --scanbus
- If you get output similar to these below, from the above commands that means you're all good and the device/s work, just use the sr(n) label for devices in this case sr0 for burning:
wodim: Overview of accessible drives (1 found) :
-------------------------------------------------------------------------
0 dev='/dev/sr0' rwrw-- : 'HL-DT-ST' 'DVDRAM GUD0N'
-------------------------------------------------------------------------
and
scsibus2:
2,0,0 200) 'HL-DT-ST' 'DVDRAM GUD0N ' '1.00' Removable CD-ROM
2,1,0 201) *
2,2,0 202) *
2,3,0 203) *
2,4,0 204) *
2,5,0 205) *
2,6,0 206) *
2,7,0 207) *
- You can also check to see if your kernel has support for burning or the proper kernel modules are loaded, Use lsmod command to check for modules named "sr_mod" and "sg", issue command:
$ lsmod | grep sr_mod
and
$ lsmod | grep sg
- If it is built
into kernel then check output command of dmesg.
- You could also check permissions for device at /dev/sr0, issue command:
$ ls -l /dev/sr0
- Make sure to be root user when using wodim, to avoid errors and complications
-----------------------------------------------------------------------------------------------------------------------------------------------------------
2.) geniosimage, issue command at terminal:
$ genisoimage -r -J -o /path-to-bootable-linux-iso/foo.iso /dev/sr0
-----------------------------------------------------------------------------------------------------------------------------------------------------------
3.) growisofs, issue command at terminal:
(for CD)
$ growisofs -speed=4 -use-the-force-luke=dao -Z /dev/sr0=/path-to-bootable-linux-iso/foo.iso
/or
(for DVD)
$ growisofs -speed=4 -dvd-compat -use-the-force-luke=dao -Z /dev/sr0=/path-to-bootable-linux-iso/foo.iso
- The -dvd-compat option is also used so that a complete lead-out is written to the media for maximum compatibility.
- The option -use-the-force-luke sets the write mode in this example DAO is used (and it is recommended for burning bootable ISO files to discs), as -use-the-force-luke=dao, see notes below for some information about write modes
-----------------------------------------------------------------------------------------------------------------------------------------------------------
4.) bashburn, install bashburn and run it in command line:
$ bashburn
- Go through the menus to edit configurations and burn your iso
-----------------------------------------------------------------------------------------------------------------------------------------------------------
Notes:
- Make sure the apps you use here are installed in your system, if not then install them the way you would as your other apps in your chosen linux distribution
- Before burning downloaded bootable linux ISO file make sure the ISO file has been verified with its indicated checksum, from the upstream source where you got it from
- When burning bootable linux iso to disc (or even any data like audio files), its better to use a slower burning speed, safe choices are speeds of 2 or 4, slow burning is less error prone and allows the burning process to be done correctly and puts less stress on the CPU, burn in slow speeds to avoid making coasters (useless discs or a non-rewritable disc whose burn failed for any reason and cannot be repaired.).
- About Write Modes 101 (TAO, DAO, SAO, RAW, IPW):
Track-At-Once
CD content is subdivided into consecutive sets of sectors known as tracks. In Track-At-Once (TAO) mode the laser stopped and restarted between each track. This delay causes transitional areas, known as pre-gaps between the tracks. These cannot be avoided, but recorders which support Variable-Gap Track-At-Once can adjust the size of the pre-gap to a minimum of 2 sectors (2/75 of a second).
With most drives TAO mode is required for multi-session recording.
Disc-At-Once
In Disc-At-Once (DAO) mode disc contents are recorded in a single pass without stopping the laser. This allows data to be written to the the pre-gap areas to avoid them altogether.
Session-At-Once
In Session at Once (SAO) mode multiple sessions can be recorded and finalized on a single disc. The resulting disc can be read by computer drives, but sessions after the first are generally not readable by CD Audio equipment.
In Wodim, the DAO and SAO modes are synonymous. While most drives require multi-session discs to be authored in TAO mode, Wodim also has support for creating multi-session discs in SAO mode, assuming the underlying disc drive supports this.
Raw Mode
Disc images of CD-ROMs can be created either in raw mode (extracting 2,352 bytes per sector independent of the sector mode) or by obtaining only the actual data in the sector (2,048/2,336/2,352/2,324 bytes depending on the sector mode).The file size of raw mode disc images is always a multiple of 2,352 bytes. When such disc images are written to an optical media in raw mode, the 2,352 byte sectors, which already include the synchronization pattern and possibly error detection and correction data, are written to the disc as they are.
Packet Writing
Incremental Packer Writing (IPW) allows optical discs to be used in a manner similar to a writable block devices, i.e. it allows files to be created, modified or deleted on demand. This is achieved by writing a series of short (32k-256k) tracks on the disk in packet mode. CD-R/RW discs can be formatted into such packets, and the kernel pktcdvd module (packet writing driver) buffers up writes to the disk and transparently handles erasing and rewriting a whole packet at a time.
*In short when burning bootable linux ISO to disc, especially if its a DVD ISO it is best to just use DAO or as a secondary use SAO if DAO is not in the choices available for you, for writing audio CDs and you want a gap in between songs, use TAO.
- It is recommended to run wodim as root, as it says in ("http://linux.die.net/man/1/wodim"), excerpt "In any case, the user running wodim needs read and write access to the particular device file on a Linux system. It is recommended to be root or install the application as suid-root, because certain versions of Linux (kernel) limit the set of SCSI commands allowed for non-root users. Even if usage without root identity is possible in many cases, some device drivers still may fail, show unexplainable problems and generally the problems become harder to debug. The risk for buffer-underruns is also increased. See the PROCESS SCHEDULING PRIORITY section below for more details. " I've actually tried using it on a non-root user and it does give errors and problems, to avoid coasters and wasting your time just run it as root user.
- If for some reason you can't eject it with the button on your cd/dvd drive, or you just want to eject with a terminal command, you can eject it with the following commands:
$ eject
/or (to eject a specific rom device, especially if you have several rom devices plugged in where your rom is sr0 here if it isnt, replace the device with the one your system uses.)
$ eject /dev/sr0
Reference Links:
- "ftp://ftp.slackware.com/pub/slackware/slackware-current/isolinux/README.TXT"
- "https://www.freebsd.org/doc/handbook/creating-dvds.html"