Make a bootable USB stick from an ISO image

NOTE: There is never a trailing number on the end of your /dev/sdx USB device.

ISO from CD/DVD

To make an ISO from your CD/DVD, place the media in your drive but do not mount it. If it "automounts", unmount it (eg, umount /dev/cdrom).

For a DVD:

dd if=/dev/dvd of=dvd.iso

For a CD:

dd if=/dev/cdrom of=cd.iso

For a CD (as SCSI):

dd if=/dev/scd0 of=cd.iso

also,

cat /dev/cdrecorder >> /home/username/isoimagename.iso

ISO from files on Hard Drive (HDD)

To make an ISO from files on an HDD, create a directory which holds the files you place in your ISO image. Then use the mkisofs command.

Example commands:

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/.

mkisofs -o isoimagename.iso -J -r /home/username/directory_for_iso

where -J means use "Joliet" (i.e., generate Joliet directory records in addition to regular iso9660 file names. This is primarily useful when the discs are to be used on Windows-NT or Windows-95 machines). The -r is for the directory and file permissions, user/group IDs, etc.

Burn ISO (image) to a CD

Once you have built your .iso, you can burn this image to a CD using:

$ cdrecord -v speed=8 dev=ATA:1,1,0 isoimagename.iso

where the dev parameters can be found by issuing the following as root:

$ cdrecord -scanbus

you can also simulate/test a burn first to make sure everything is good by:

$ cdrecord dev=0,0 -v -dummy isoimagename.iso

Note: You should use 'dev=/dev/hdX' with v2.6 and later kernels.
For example, if your CD drive is on /dev/hdc:

Make the UDF filesystem: Once the disc is formatted, you can create the UDF filesystem on the disc:

mkudffs --lvid="dvdrw-backup" --udfrev=0x0150 /dev/hdd

You can add your own options but it's a good thing to use UDF revision 1.50 since it can avoid compatibility problems with several operating systems. Of course, you should change the volume ID. Here is an example of the output of mkudffs:

Mount the disc and copy the files: The media is now formatted as UDF. Now mount it in read-write (rw) mode. First, create a mount point:

mkdir -p /mnt/dvdrw
mount -t udf -o rw,noatime /dev/hdd /mnt/dvdrw

Copy files: You can now write your files in /mnt/dvdrd as you would for any mounted partition of your hard disk. (Note: Be careful not to go over to maximum amount of space available on a DVD {4.7 GB for a simple layer disc}).

For example, if you want to use Partimage to save a partition to the disc, you can type this sort of command:

Umount the disc: Remember to unmount the disc when you are done and run sync to force the data to be physically written:

umount /mnt/dvdrw
sync

Mount an ISO image in Linux

It is possible to mount an ISO image in Linux just like any device or file system. This is a convenient way of backing up your CDs and DVDs onto your hard drive and be able to read all of the files on these discs. It is also a good way to check your ISO images before burning them to disc.

Step 1: Create a mount point for the ISO:

mkdir /mnt/iso

Step 2: Now mount the ISO in the mount point with the following command:

mount myiso.iso /mnt/iso -t iso9660 -o ro,loop=/dev/loop0

where myiso.iso is your ISO file.

You can also place the above mount command in your /etc/fstab file for automatic mounting upon boot up (and as a "permanent" mount).

If you wish to mount more than one ISO image, you can use a different device (e.g. /dev/loop1). By default you have 8 loop devices (loop0 - loop7). You can extend this number up to 255. To do this, you will need to edit your /usr/src/linux/drivers/block/loop.c file and change the following: