Have a CD or DVD lying around that you are sick of putting in the drive every time you need something on the disc?
How about just making an .iso file that you can mount as you need? Or maybe you just want a “master” copy of the media so you can create another copy at a future date.
At any rate it is rather easy to accomplish in Ubuntu:
sudo umount /dev/cdrom
dd if=/dev/cdrom of=file.iso bs=1024
You can also do the same with folders:
mkisofs -r -o file.iso /location_of_folder/
Don’t forget to make a checksum:
md5sum file.iso > file.iso.md5
This is very helpfull to backup you cd and dvd into iso images:
To make an ISO from your CD/DVD, place the media in your drive but do not mount it. If it automounts, unmount it. (ubuntu automount so you need to unmount, that's quite easy, just choose the option unmount from the shell).
dd if=/dev/dvd of=dvd.iso # for dvd
dd if=/dev/cdrom of=cd.iso # for cdrom
dd if=/dev/scd0 of=cd.iso # if cdrom is scsi
To make an ISO from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command.
mkisofs -o /tmp/cd.iso /tmp/directory/
This results in a file called cd.iso in folder /tmp which contains all the files and directories in /tmp/directory/.
For more info, see the man pages for mkisofs, losetup, and dd, or see the CD-Writing-HOWTO at http://www.tldp.org.
1. Create ISO Images With K3b
K3b is the KDE default CD/DVD burner and also one of the most popular (if not the most popular) burning application for Linux. The current version comes installed by default in Kubuntu 8.10 and 9.04, but if you are using Ubuntu and want to get install it issue the following command:
sudo apt-get install k3b
A port for KDE4 is in the works too, but until now there is no stable release. (Update: This applies for K3b 2.0+ too)
To create an ISO image just fire up K3b and follow the steps below:
Go to File -> New Project -> New Data CD Project (or New Data DVD Project, depending on what size the image you want to create will have):
Next, drag and drop the files and folders from the file browser to the bottom area:
Now, click the Burn button and, in the window that appears, tick the Only create image option under the Settings widget. The image will be created by default as the /tmp/kde-YOUR_USERNAME/image_name.iso, but you can change this location in the Image tab.
Next, click on Start and wait for the image to be created. This should be all.
Here's what the file /var/kde-embryo/my_iso_image.iso shows:
embryo@kubu:~$ file /tmp/kde-embryo/my_iso_image.iso
/tmp/kde-embryo/my_iso_image.iso: ISO 9660 CD-ROM filesystem data 'my_iso_image '
2. Create ISO images with Brasero
Brasero is the default CD/DVD burning application in Ubuntu. The way Brasero creates images is similar with K3b's. If you don't have Brasero installed for some reason, type:
sudo apt-get install brasero
Start Brasero (or fire it up, as you wish to call it) and click on the Data project button (or go to Project -> New Project -> New Data Project).
Change the name of the disc at the bottom to whatever you like and then click on the green plus sign in the upper left corner in the toolbar to start adding files and directories to your image:
After you finished adding files click on Burn and make sure no empty CD/DVD is in your optical drives:
This should be all. The image will be located in the home directory.
3. Create ISO images using AcetoneISO
AcetoneISO is a GUI (graphical user interface) application built in Qt4 for mounting and unmounting CD/DVD ISO (NRG, MDF and BIN too) images, but it can also be used to create ISO images.
To install AcetoneISO in Ubuntu you can follow the guide I put up a while ago, here. I will use version 2.0.2 for this example. In newer Ubuntu versions, just type in a terminal:
sudo apt-get install acetoneiso
First, put all the files and folders you want included in the image into a new, empty directory. Next, in the menu go to Conversion -> Generate ISO from folder, select the desired folder and enter the name of the image:
4. Create ISO images using command-line
What, you thought I was going to leave CLI behind? Here's (probably) the easiest way to create ISO images using command-line interface.
First, install the tool called genisoimage (if you already have Brasero or K3b installed, this package is probably already installed):
sudo apt-get install genisoimage
Use it like this:
genisoimage -o my_image.iso my_directory
genisoimage -o my_image.iso file01 file02 file03
The first command will create an ISO image from the contents of folder my_directory (and it will include it as the root directory), while the second one will create an image containing file01, file02, file03 (and no root directory).
For Rock Ridge extensions (which provide permissions and ownership support), use:
genisoimage -o my_image.iso -R my_directory
So, these are the four methods I find most accessible for creating CD/DVD images in Ubuntu. Please share other ways of accomplishing this in the comments below.