35

How to create a iso image from a folder or single files via terminal commands? Currently i am doing this via Braseros GUI, but i want to do it with a shell script.

  • 1
    man genisoimage says it all as well. – poige Sep 15 '13 at 19:17
51

Seems to be pretty straightforward to do with genisoimage, in the package with the same name on Debian:

genisoimage -o output_image.iso directory_name

There are many options to cover different cases, so you should check the man page to see what fits your particular use case.

See also

  • I have googled my question, but i haven't found an answer mentioning genisoimage. Thanks for the quick answer! – klingt.net Sep 15 '13 at 19:43
  • 3
    @klingt.net In my case, I knew there was such a command but couldn't remember its name. So I did apropos iso, found genisoimage then used the search terms "generate iso with genisoimage". – Joseph R. Sep 15 '13 at 19:46
  • apropos is another command that i can't remember :) – klingt.net Sep 15 '13 at 20:08
  • 3
    under unix apropros is a synonym for man -k. The latter being a little easier to remember/spell ;) – Drav Sloan Sep 15 '13 at 21:37
  • 8
    genisoimage is a dead fork from a mkisofs version from 2004. genisoimage creates filesystem images with defects. This problem can be avoided by using the original software mkisofs instead. – schily May 31 '16 at 13:16
19

Making a CD from a folder can be performed with mkisofs.

mkisofs -lJR -o output_image.iso directory_name

-l : Allow full 31 character filenames.

-J : Generate Joliet directory records in addition to regular iso9660 file names.

-R : Generate System Use Sharing Protocol (SUSP) and Rock Ridge (RR) records using the Rock Ridge protocol

https://linux.die.net/man/8/mkisofs https://en.wikipedia.org/wiki/Rock_Ridge

6

Take this basic command of:

  mkisofs -o output_image.iso directory_name

One step further, by adding a volume label to the iso, and compressing the iso-image with gzip

  mkisofs -V volume_label -r folder_location | gzip > output-image-comressed.iso.gz

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.