Difference between revisions of "ISO Images"

From Christoph's Personal Wiki
Jump to: navigation, search
 
Line 15: Line 15:
  
 
== ISO from files on Hard Drive (HDD) ==
 
== 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.
+
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 <tt>mkisofs</tt> command.
  
 
* Example commands:
 
* Example commands:
 
  mkisofs -o /tmp/cd.iso /tmp/directory/
 
  mkisofs -o /tmp/cd.iso /tmp/directory/
This results in a file called <tt>cd.iso</tt> in folder <tt>/tmp</tt> which contains all the files and directories in <tt>/tmp/directory/</tt>.
+
This results in a file called <code>cd.iso</code> in folder <code>/tmp</code> which contains all the files and directories in <code>/tmp/directory/</code>.
  
 
  mkisofs -o isoimagename.iso -J -r /home/username/directory_for_iso
 
  mkisofs -o isoimagename.iso -J -r /home/username/directory_for_iso
Line 25: Line 25:
  
 
== Burn ISO (image) to a CD ==
 
== Burn ISO (image) to a CD ==
Once you have built your .iso, you can burn this image to a CD using:
+
Once you have built your <code>.iso</code>, you can burn this image to a CD using:
 
  cdrecord -v speed=8 dev=ATA:1,1,0 isoimagename.iso  
 
  cdrecord -v speed=8 dev=ATA:1,1,0 isoimagename.iso  
 
where the <code>dev</code> parameters can be found by issuing the following as root:
 
where the <code>dev</code> parameters can be found by issuing the following as root:
Line 37: Line 37:
  
 
* Step 2: Now mount the ISO in the mount point with the following command:
 
* 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
+
  mount myiso.iso /mnt/iso -t iso9660 -o ro,loop=/dev/loop0
where myiso.iso is your ISO file.
+
where <code>myiso.iso</code> is your ISO file.
  
 
You can also place the above mount command in your <code>/etc/fstab</code> file for automatic mounting upon boot up (and as a "permanent" mount).
 
You can also place the above mount command in your <code>/etc/fstab</code> file for automatic mounting upon boot up (and as a "permanent" mount).

Revision as of 03:34, 10 March 2007

This article will explain how to make ISO images in a Linux environment and various other things you can do with/to ISO images. Everything will be done from the CLI (or command line).

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

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:

#define MAX_LOOP 8

to

#define MAX_LOOP 255

and then rebuild the module. (see here: Linux Loop Devices for details.)

See also