Banner of 5532d031054ff5c57967.png

How to Create an ISO from a Directory in Linux


Category: Linux

📅 June 03, 2024   |   👁️ Views: 8

Creating an ISO image from a directory in Linux can be done using the mkisofs or genisoimage command. Follow these steps:

1. Install mkisofs or genisoimage

If you don't have mkisofs or genisoimage installed, you can install it using your package manager. For most Linux distributions, the package is named genisoimage.

For Debian-based distributions (like Ubuntu):



sudo apt-get install genisoimage

For Red Hat-based distributions (like Fedora):



sudo yum install genisoimage

2. Create the ISO

Use the mkisofs or genisoimage command to create the ISO. The basic syntax is:



mkisofs -o output.iso /path/to/directory

or



genisoimage -o output.iso /path/to/directory

Example:



mkisofs -o mydisk.iso /home/user/myfolder

or



genisoimage -o mydisk.iso /home/user/myfolder

3. Additional Options

You can use various options with mkisofs or genisoimage to customize the ISO creation process. Some common options include:

  • -V "Volume Label": Sets the volume label.

  • -R: Enables Rock Ridge extensions, which are useful for retaining file permissions and longer filenames.

  • -J: Enables Joliet extensions, which allow the ISO to be read by Windows systems.

Example with additional options:



mkisofs -o mydisk.iso -V "MY_DISK" -R -J /home/user/myfolder

or



genisoimage -o mydisk.iso -V "MY_DISK" -R -J /home/user/myfolder

After running the command, you will have an ISO file named output.iso (or mydisk.iso in the examples) that contains the contents of the specified directory.


← The Impact of Capitalism on Marriage and Family Dynamics Why You Should Switch to Linux →