Since we’ve already covered how to rip a cd or DVD to an ISO file in Linux, the next logical step would be to talk about how to burn an ISO image to a CD or DVD. Again, we’ll be attacking this question from our handy-dandy terminal, so open your favorite terminal and let’s get to work.
Before we begin, let’s clarify our goals here. For now, we simply wish to burn an ISO image file directly to recordable media, such as a CD or a DVD, from the terminal in Linux. There are many GUI programs out there for burning DVDs and CDs, but that’s not quite our goal here. We want to harness the power of the terminal for automation of tasks and for learning’s sake.
First, let’s install a nifty little program called wodim. It includes many tools for implementation-agnostic writing to recordable media, including our target formats of DVD and CD. If you’re using Ubuntu 9.10, you should already have it installed, but it can’t hurt to run this to make sure:
sudo apt-get install wodim
Now, let’s take our ISO file and burn it to a CD-R in our CD-R drive. Enter this into your terminal and let’s get started with the burn:
sudo wodim -eject /home/rfkrocktk/my-disc.iso
Of course, replace “/home/rfkrocktk/my-disc.iso” with a real path to an ISO image file on your computer. If you’d like to do a “dry run,” so to speak, to test if everything will write correctly, run the following command instead:
sudo wodim -eject gracetime=30 /home/rfkrocktk/my-disc.iso
What this does is that it gives you 30 seconds of “grace time” to make sure you really want to burn that disc. The “-eject” parameter tells wodim to eject your disc after it’s done, very helpful if you ask me. Another handy feature about wodim is that it attempts to recognize the drive to use when burning media (eg: /dev/dvdrw or /dev/cdrw), and attempts to recognize the type of media you have inserted, so it uses the right device and format.
What this means is that the code given above should work for burning an ISO image to a CD or to a DVD. This makes it, for all intensive purposes, implementation-agnostic, meaning it doesn’t necessarily care whether you’re using a CD or a DVD. It’ll do its best to determine the type of media you’re using and burn it in an appropriate fashion.
By default, wodim burns discs in TAO (“Track at Once”) format. This is important only if you’re planning on burning audio discs. For audio discs, you’ll want to burn your discs in SAO/DAO (“Session At Once/Disc At Once”) mode, because TAO mode will insert 2 second gaps between your songs, and for me that’s unacceptable. We’ll cover burning audio discs in another post, so stay tuned for another tutorial on how to do that.
What if we want to do something a little more, well, advanced? You’ve probably heard of multi-session discs that allow you to take something which is “write-once” like a DVD-R or a CD-R and write to it multiple times. wodim supports this out-of-the-box using the “-multi” parameter as so:
sudo wodim -multi -eject /home/rfkrocktk/my-disc.iso
This will enable you to write multiple times to the same disc, provided that you pass the “-multi” parameter each time you attempt to change content on the disc. Pretty cool, huh?
You can’t get much easier or complex than wodim. You can run “sudo wodim my-disc.iso” to simply burn an ISO image to a DVD or CD, or you can really tweak your burn to do exactly what you want it to. Any questions or comments? Hope this helps someone out there!