Do you know there is a simple and efficient Linux command line program to create ISO image of a directory or filesystem or CD or DVD? This is very helpful to backup your hard drive, cd and dvd into iso images.
Create ISO from Hard Drive
To make an ISO from files on your hard drive, create a directory which holds the files you want. Then use the mkisofs command. The mkisofs package comprises of few tiny but really useful programs to deal with CD image, i.e. isodebug, isodump, isoinfo, isovfy, mkhybrid, and mkisofs.
$ mkisofs -o /tmp/hd.iso /home/jonboy60/
(This results in a file called hd.iso in folder /tmp which contains all the files and directories in /home/jonboy60/)
To create CD ISO image of directories that contain long file name or non-8.3 format (particularly if you want to burn the CD image for use in Windows system), use the -J option switch that generates Joliet directory records in addition to regular iso9660 file names. For example:
$ mkisofs -o /tmp/hd.iso -J /home/jonboy60
Create ISO from CD and 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. Automount so you need to unmount, that’s quite easy, just choose the option unmount from the shell. Example:
$ umount /dev/cdrom
$ umount /mnt/cdrom
dd is a perfect tool for copy a file, converting and formatting according to the operands. It can create exact CD-ROM ISO image.
$ dd if=/dev/cdrom of=/tmp/cd.iso
(for cdrom – if=/dev/cdrom: Read from /dev/cdrom, of=/tmp/cd.iso: write to FILE cd.iso in tmp directory)
$ dd if=/dev/scd0 of=/tmp/cd.iso
(for cdrom is scsi – if=/dev/scd0: Read from /dev/scd0, of=/tmp/cd.iso: write to FILE cd.iso in tmp directory)
$ dd if=/dev/dvd of=/tmp/dvd.iso
(for dvd – if=/dev/dvd: Read from /dev/dvd, of=/tmp/dvd.iso: write to FILE dvd.iso in tmp directory)
For more info, see the man pages for mkisofs, losetup, and dd at http://www.tldp.org.