How to Make ISO from Directory in Linux

Creating an ISO file from a directory in Linux is a useful task for various purposes, such as distributing software, creating bootable media, or backing up data.

ISO files are a standard format for storing and distributing data, and they can be easily created using the command line in Linux.

In this article, we will guide you through the process of creating an ISO file from a directory using the genisoimage command.

TecMint Weekly Newsletter
Get the Learn Linux 7 Days Crash Course free when you join 34,000+ Linux professionals reading every Thursday.
Check your email for a magic link to get started.
Something went wrong. Please try again.

Step 1: Installing genisoimage Tool in Linux

The genisoimage package is used for creating ISO-9660 CD-ROM filesystem images in Linux. It is a pre-mastering program that can be used to create bootable CDs and CDs with support for the Macintosh HFS filesystem.

The package is part of the cdrkit suite and includes tools like mkzftree, dirsplit, and geteltorito for working with ISO images.

To install genisoimage on Linux, use the following appropriate command for your specific Linux distribution.

sudo apt install genisoimage         [On Debian, Ubuntu and Mint]
sudo yum install genisoimage         [On RHEL/CentOS/Fedora and Rocky/AlmaLinux]
sudo emerge -a sys-apps/genisoimage  [On Gentoo Linux]
sudo apk add genisoimage             [On Alpine Linux]
sudo pacman -S cdrtools              [On Arch Linux]
sudo zypper install genisoimage      [On OpenSUSE]    
sudo pkg install genisoimage         [On FreeBSD]

Step 2: Creating an ISO File from a Directory

Navigate to the parent directory of the directory you want to create the ISO file from using the cd command.

For example, let’s assume your directory is called my_folder and is located in your home directory, you can use the following command:

cd /home/ravi/

Now, run the genisoimage command to create the ISO file.

genisoimage -o my_folder.iso my_folder/

Here’s what each part of the command means:

  • genisoimage -: This is the command used to create the ISO file.
  • -o output.iso – This specifies the output file name for the ISO file. In this case, it will be named "my_folder.iso".
  • my_folder – This is the name of the directory you want to create the ISO file from.

Once the command completes, you should have an ISO file named my_folder.iso in your current directory. To verify that the ISO file was created correctly, you can use the ls command:

ls -lh my_folder.iso
Create ISO File from a Directory
Create ISO File from a Directory

Step 3: Mount the ISO File (Optional)

To ensure that the ISO file contains the correct data, you can mount it and check its contents. Create a mount point (a directory where you will mount the ISO) and mount the ISO file using the following commands:

sudo mkdir /mnt/iso
sudo mount -o loop my_folder.iso /mnt/iso

Now, you can navigate to /mnt/iso and check the files:

cd /mnt/iso
ls

This will show you the contents of the ISO file. When you’re done, unmount the ISO file:

cd ~
sudo umount /mnt/iso
Mount ISO File
Mount ISO File
Conclusion

Creating an ISO file from a directory in Linux is a simple process involving a few commands. By following this guide, you can easily create an ISO file for backups, distribution, or other purposes.

If this article helped, with someone on your team.

TecMint Weekly Newsletter
Get the Learn Linux 7 Days Crash Course free when you join 34,000+ Linux professionals reading every Thursday.
Check your email for a magic link to get started.
Something went wrong. Please try again.
TecMint has been free for 14 years. Help keep it that way.
Google AI Overviews and tools like ChatGPT have cut into search traffic for independent tech sites like TecMint. Running this site costs over $2,000 every month for hosting, infrastructure, and paying authors to keep the content accurate and tested.

If this article helped you solve a problem, consider buying a coffee. It helps keep TecMint free, supports the authors, and keeps the project going.
☕ Buy Me a Coffee
Ravi Saive
I'm Ravi Saive, an award-winning entrepreneur and founder of several successful 5-figure online businesses, including TecMint.com, GeeksMint.com, UbuntuMint.com, and the premium learning hub Pro.Tecmint.com.

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

1 Comment

Leave a Reply

Got Something to Say? Join the Discussion...

Thank you for taking the time to share your thoughts with us. We appreciate your decision to leave a comment and value your contribution to the discussion. It's important to note that we moderate all comments in accordance with our comment policy to ensure a respectful and constructive conversation.

Rest assured that your email address will remain private and will not be published or shared with anyone. We prioritize the privacy and security of our users.

Free Course
Get a free Linux course before you go.
Subscribe to TecMint Weekly and get the Learn Linux 7 Days Crash Course free. Read by 34,000+ Linux professionals every Thursday.
Something went wrong. Please try again.
Check your email for a magic link to get started.