How to create an ISO image of a directory with the command line.

Creating an ISO image of a directory is useful sometimes. This command will create an ISO image of a directory, ready to burn to a CD or DVD.

[email protected]:~$ genisoimage -l -V hi -r ~/Downloads/stuff > cdrom.iso

Here is example usage, creating an ISO of a directory so I could mount it to a KVM virtual machine.

[email protected]:~$ genisoimage -l -V hi -r ~/Downloads/stuff > cdrom.iso
I: -input-charset not specified, using utf-8 (detected in locale settings)
Total translation table size: 0
Total rockridge attributes bytes: 1548
Total directory bytes: 2406
Path table size(bytes): 26
Max brk space used 0
191 extents written (0 MB)

This is a very useful Linux tip and would be an easy way to prepare a folder full of files for backup. The -l parameter allows for long filenames to be written into the ISO file.

The ISO file may also be compressed to save space depending upon what is in the ISO file.

genisoimage -l -V hi -r ~/Downloads/stuff | gzip > cdrom.iso.gz

Another way to save space on your drive!

No comments have been made. Use this form to start the conversation :)

Leave a Reply