mkisofs: Repackaging a Linux Install ISO

Repackaging a Linux installation DVD using mkisofs

Written by Benjamin Cane on 2013-06-12 12:39:19

In the office I use Red Hat quite often and one of the quicker ways to provision a Red Hat server is via kickstart. There are many ways to reach a kickstart file during initial install (NFS, HTTP, FTP) but one of the ways I commonly use is to put the file on the installation DVD itself.

The below steps are what I use to add a custom directory to the installation iso file.

Mount the official ISO as a directory

In order to access the contents of the ISO file we can mount it as a file system.

# mkdir -p /mnt/linux
# mount -o loop /tmp/linux-install.iso /mnt/linux

Copy the contents to a working directory

Since the ISO is read-only we will need to copy the contents into another directory that we can modify and add what we want.

# cd /mnt/
# tar -cvf - linux | (cd /var/tmp/ && tar -xf - )

Make your changes

At this point you can add to or modify any of the files and directories in the /var/tmp/linux directory.

Repackage the directory into a new ISO file

Once finished we will repackage the directory into a new boot-able ISO file.

# cd /var/tmp/linux
# mkisofs -o ../your-new.iso -b isolinux/isolinux.bin -c isolinux/boot.cat 
-no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V Your Disk Name Here .

Picture of Benjamin Cane

Benjamin is a Systems Architect working in the financial services industry focused on platforms that require Continuous Availability. He has been working with Linux and Unix for over 10 years now and has recently published his first book; Red Hat Enterprise Linux Troubleshooting Guide.

Publications

Identify, capture and resolve common issues faced by Red Hat Enterprise Linux administrators using best practices and advanced troubleshooting techniques

What people are saying:
Excellent, excellent resource for practical guidance on how to troubleshoot a wide variety of problems on Red Hat Linux. I particularly enjoyed how the author made sure to provide solid background and practical examples. I have a lot of experience on Red Hat but still came away with some great practical tools to add to my toolkit. - Amazon Review

Sponsored by