********************************
For information on how to install cdrtools, take a look at the 2nd post in this thread
*********************************************
You can make an ISO file out of a folder as follows:
Code:
mkisofs -fRrlJ -A Disc_Volume_Label_Goes_Here -o name_of_iso_file.iso name_of_folder
You can burn an ISO file to disc as follows:
Code:
cdrecord dev=/dev/hda name_of_iso_file.iso
But if you don't want to waste time and disk space creating an ISO file, you pipe the output of mkisofs into the input of cdrecord (yes it's as cool as it sounds). As follows:
Code:
mkisofs -fRrlJ -A Disc_Volume_Label -o - name_of_folder | sudo cdrecord dev=/dev/hda -
(Note that I've replaced the input and output file names with hyphens)
On some systems, including my own, this final command fails because cdrecord wants to be told the track size (maybe some drives won't start burning unless they know the track size?). If anyone has any info on this, get back to me in this thread and we can troubleshoot it. Maybe we could do something like:
Code:
mkisofs -fRrlJ -A Disc_Volume_Label -o - name_of_folder | sudo cdrecord -tsize=`some_command_that_will_get_the track_size_for_us` dev=/dev/hda -
Also if I've made any errors post back quickly and I'll fix it.
I got all my info from this site:
Command-line CD-ROM burning in Linux
In trying to figure out why cdrecord was failing on my computer, I stumbled across something. It turns out there's a massive controversy in Linux regarding the cdrtools package (this package contains such programs as mkisofs, cdrecord).
Basically there are two different parties developing a package by the same name, they're both calling it "cdrtools", and they do not get on well with each other. They started out as one group, but then they split. You can read about it here:
Cdrtools - why do Linux distributions create bad forks?
One of the cdrtools packages is way better than the other. One of them is stable, while the other is buggy. Unfortunately it is the buggy one that made it into Ubuntu's repositories.
The buggy version creates symbolic links in "/usr/bin" for files such as mkisofs and cdrecord. If you do the following:
Code:
ls -l /usr/bin/cdrecord
then you'll be able to see what the symbolic link points to. If it points to "wodim", then you've got the buggy version.
So without further a do, here's how you get the stable version of cdrtools. You're best off copy-pasting the following into a script called "get_stable_cdrtools.sh", then giving it execution permissions and running it as root as follows:
Code:
chmod +x get_stable_cdrtools.sh
sudo ./get_stable_cdrtools.sh
Here's the code for the script. (This script was written by a guy called IgnorantGuru over on the Ubuntu forums).
Code:
# install compiler tools
sudo apt-get install build-essential
# Make sure you're in the home folder
cd
# Make a working folder and change to it
mkdir cdrtools
cd cdrtools
# Download latest cdrtools from http://cdrecord.berlios.de/private/linux-dist.html
wget ftp://ftp.berlios.de/pub/cdrecord/alpha/cdrtools-beta.tar.gz
# Unpack
tar xzf cdrtools-beta.tar.gz
# CD to the directory cdrtools is in.
cd cdrtools-2.01.01
# Compile and install
sudo make
sudo make install
sudo make clean
# Files are installed to /opt/schily
# (you may want to change their ownership to root:root)
sudo chown root:root /opt/schily/bin/*
# Move the following files (some will be links) from /usr/bin to a junk folder...
sudo mkdir /opt/schily/replacedfiles
sudo mv /usr/bin/cdrecord /opt/schily/replacedfiles
sudo mv /usr/bin/genisoimage /opt/schily/replacedfiles
sudo mv /usr/bin/mkisofs /opt/schily/replacedfiles
sudo mv /usr/bin/readom /opt/schily/replacedfiles
sudo mv /usr/bin/wodim /opt/schily/replacedfiles
# Create links:
sudo ln -s /opt/schily/bin/cdrecord /usr/bin/cdrecord
sudo ln -s /opt/schily/bin/mkisofs /usr/bin/genisoimage
sudo ln -s /opt/schily/bin/mkisofs /usr/bin/mkisofs
sudo ln -s /opt/schily/bin/readcd /usr/bin/readom
sudo ln -s /opt/schily/bin/cdrecord /usr/bin/wodim
sudo ln -s /opt/schily/bin/readcd /usr/bin/readcd
sudo ln -s /opt/schily/bin/mkhybrid /usr/bin/mkhybrid
sudo ln -s /opt/schily/bin/cdda2wav /usr/bin/cdda2wav
# Remove working folder
cd ~
sudo rm -r cdrtools
After you do this, you have a fully-functional, non-buggy installation of cdrtools.
I still haven't figured out the problem of specifying the track size, and I sent the developers of cdrtools an e-mail about it, but I've a feeling they won't respond because they said they had to cut off "personal support" because they were just getting too many e-mails.
If anyone knows a solution to the "track size" problem, post it here please. I wonder if there's some way of getting mkisofs to say how big the ISO file will be. Maybe something like
Code:
mkisofs --just-tell-the-size
If so we could use this as follows:
Code:
mkisofs -fRrlJ -A Disc_Volume_Label -o - name_of_folder | sudo cdrecord -tsize=`mkisofs --just-tell-the-size -fRrlJ -A Disc_Volume_Label name_of_folder` dev=/dev/hda -
I've looked through the manual for mkisofs already though and haven't found anything yet.
After 2 days of investigating I finally got to the bottom of it 
mkisofs has a command line option "-print-size" that will tell you the size of the ISO it would have created.
So here's how you quickly burn a folder to disc:
Code:
mkisofs -fRrlJ -A Disc_Volume_Label Name_Of_Folder | sudo cdrecord tsize=`mkisofs -quiet -print-size -fRrlJ -A Disc_Volume_Lable Name_Of_Folder` dev=/dev/hda -
You could make a script out of it as follows:
Code:
mkisofs -fRrlJ -A $1 $1 | sudo cdrecord tsize=`mkisofs -quiet -print-size -fRrlJ -A $1 $1` dev=/dev/hda -
And then run the script as:
Code:
burnfolder.sh Name_Of_Folder
Now if you're lucky, this command won't just freeze your command line indefinitely and sit there doing nothing... like it does on my computer... f*** sake. It turns out that since I switched from the buggy cdrtools to the stable cdrtools, it won't burn anything to disc for me anymore even if I try to burn a simple ISO file to disc. Even if I do "cdrecord -scanbus", it just freezes and does nothing
Another thing to troubleshoot.