keepcalculator

06 Numbers and Powers

Create ISO From Command Line: Full Guide

Card No. 06·65325 · Updated · Standard formula, shown below

Yes, you can create an ISO file from the command line on Windows, macOS, and Linux. This guide shows the exact commands for each system, explains how they work, and covers common pitfalls like bootable ISOs and file permissions.

Why Use the Command Line for ISO Creation?

Graphical tools like Brasero or ImgBurn are easy, but the command line offers scripting, remote server use, and lighter resource usage. You can automate ISO creation in cron jobs or CI pipelines. It also works on headless systems where no GUI exists.

Linux: mkisofs/genisoimage and xorriso

The most common tool is genisoimage (a fork of mkisofs). On Debian/Ubuntu, install with sudo apt install genisoimage. Basic usage:

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

For a bootable Linux ISO, use xorriso which handles El Torito boot records:

xorriso -as mkisofs -o bootable.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table /path/to/iso-content

To include Rock Ridge (Unix permissions) and Joliet (Windows compatibility), add -R -J.

Windows: oscdimg and PowerShell

Windows has no native ISO creation command. Use oscdimg from the Windows ADK. After installing ADK, run:

oscdimg -n -m -o -bC:\boot\etfsboot.com C:\source\ C:\output.iso

Alternatively, PowerShell with the ConvertTo-Iso function (from a script) can create a data ISO, but it lacks boot support. A simple script:

ConvertTo-Iso -Path C:\source -Output C:\output.iso

This requires downloading a community script; it is not built-in.

macOS: hdiutil

macOS includes hdiutil. To create an ISO from a folder:

hdiutil makehybrid -o output.iso /path/to/folder -iso -joliet

For a bootable macOS installer ISO, first create a read-only DMG, then convert:

hdiutil makehybrid -o /tmp/installer.iso /Applications/Install\ macOS\ Sonoma.app -iso -joliet

This works for creating a bootable USB installer too.

Common Problems and How to Fix Them

  • Permission denied: Ensure you have read access to all source files. Use sudo on Linux/macOS if needed.
  • Bootable ISO not booting: Check the boot image path and that the boot catalog is correct. For Windows, verify etfsboot.com exists.
  • File names truncated: Add Joliet (-J) on Linux or use -joliet on macOS for long names.
  • ISO too large: The ISO 9660 limit is 4 GiB for a single file. Use UDF format (-udf in genisoimage) for larger files.

Choosing the Right Tool

Use genisoimage for simple data ISOs on Linux. For bootable Linux ISOs, xorriso is more reliable. On Windows, oscdimg is the official tool for bootable Windows ISOs. On macOS, hdiutil is the only native option. If you need cross-platform scripting, consider Python’s pycdlib library.

Alternatives to Command Line

Graphical tools like Brasero (Linux), ImgBurn (Windows), and Disk Utility (macOS) offer point-and-click ISO creation. For advanced needs, tools like AnyBurn or PowerISO provide more options but are not free. The command line remains the best for automation and remote work.

Frequently Asked Questions

Can I create an ISO from a CD/DVD?

Yes. On Linux, use dd if=/dev/cdrom of=output.iso. On macOS, hdiutil makehybrid -iso -o output.iso /dev/disk2. On Windows, use third-party tools like WinCDEmu.

How do I make a bootable ISO from a folder?

You need a boot image (like isolinux.bin for Linux or etfsboot.com for Windows). Use xorriso on Linux or oscdimg with the -b flag on Windows. Simply adding files without a boot record will not boot.

What is the difference between ISO and IMG?

ISO is an optical disc image with ISO 9660 filesystem. IMG is a raw sector-by-sector copy, often used for floppy or hard drives. IMG can be converted to ISO with tools like ccd2iso.

Why does my ISO not appear in Windows Explorer?

Windows 10/11 can mount ISOs by double-clicking. If not, check file association or use third-party software like 7-Zip to extract.

Can I create an ISO from a folder with symlinks?

Yes, but symlinks are usually stored as links, not the actual files. Use -follow-links in genisoimage to dereference them, but beware of infinite loops.

Is there a limit to ISO size?

ISO 9660 has a 4 GiB file size limit. Use UDF (Universal Disk Format) to exceed it. Most modern tools support UDF, but older systems may not read it.

Related

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.

More cards in this drawer

The whole Numbers and Powers drawer →