Table of Contents
Use xorriso to build an ISO filesystem from a folder. Use dd only when you want a byte-for-byte image of a data disc that already contains the filesystem. Giving a copy of a hard drive or partition an .iso extension does not convert it into an ISO filesystem.
Create an ISO from a directory
Install xorriso through your distribution’s package manager. Put the files you want to include in a staging folder. Write the output outside that folder so the new image is not part of its own input.
xorriso -as mkisofs -r -J -V MY_DATA -o "$HOME/my-data.iso" "$HOME/files-for-iso"
The command adds Rock Ridge information for Unix readers and Joliet names for compatible Windows readers. -V sets the volume label. This creates a data image. Bootable installer images need additional boot files and settings. See the xorrisofs reference for options.
If your graphical archive tool lists ISO as an output format, you can select it when creating an image. Many versions offer only compressed archives. Use xorriso if ISO is absent.


Copy an existing data CD or DVD
Confirm the optical drive’s device name before you run the command. It is often /dev/sr0. Use a new regular file as the output and leave the drive as the input. dd can overwrite whatever destination you give it.
dd if=/dev/sr0 of="$HOME/disc-copy.iso" bs=2048 status=progress
This example is for a readable data disc. Audio discs and copy-protected media need a different workflow.
Check the finished image
Open the ISO with your desktop’s disk image mounter, or use the read-only loop mount below. Check several files before relying on the image. An ISO intended for file exchange may omit metadata needed for a full Linux system backup.
mkdir -p "$HOME/iso-check"
sudo mount -o loop,ro "$HOME/my-data.iso" "$HOME/iso-check"
ls -la "$HOME/iso-check"
sudo umount "$HOME/iso-check"
Reader Comments 0
Sign in with email or Google to join the discussion.