Creating Customized and Bootable Disk Images of Host Systems - DZone (2024)

In the realm of Linux and operating systems, disk imaging plays a vital role in various scenarios. Disk images, also known as ISOs, are essentially digital replicas of physical media such as CDs, DVDs, or hard drives. They serve as a convenient means to store and distribute entire file systems, preserving their integrity and structure. One powerful tool available in the Linux world for creating disk images is mkisofs. Developed by Eric Youngdale, mkisofs stands for "make ISO filesystem" and is commonly used to generate ISO-9660 file systems, which are the standard format for disk images.

What Is mkisofs?

Now, let's dive into how you can utilize mkisofs to create disk images on Linux. Before getting started, let us take a closer look at what mkisofs is and how to install the tool on your system.

According to Ran, mkisofs is a utility that creates an ISO 9660 image from files on disk. It is effectively a pre-mastering program to generate an ISO9660/JOLIET/HFS hybrid filesystem capable of generating the System Use Sharing Protocol records (SUSP) specified by the Rock Ridge Interchange Protocol. This is used to further describe the files in the iso9660 filesystem to a UNIX host, and provides information such as longer filenames, UID/GID, POSIX permissions, symbolic links, block, and character devices. mkisofs takes a snapshot of a directory tree and generates a binary image that corresponds to an ISO9660 or HFS filesystem when it is written to a block device. Each specified pathspec describes the path of a directory tree to be copied into the ISO9660 filesystem; if multiple paths are specified, the files in all the paths are merged to form the image.

Option Description
-o output_file.iso Specifies the name of the output ISO file
-b boot_image Specifies the location of the boot image
-c boot_catalog Specifies the location of the boot catalog
-no-emul-boot Indicates the boot process should not emulate a floppy disk
-boot-load-size size Specifies the size of the boot loader in sectors
-boot-info-table Specifies that a boot information table should be included in the ISO image
-J Indicates use of Joliet extensions
-R Indicates use of Rock Ridge extensions
-V volume_id Specifies the volume ID for the ISO image
-A application_id Specifies the application ID for the ISO image
-p publisher_id Specifies the publisher ID for the ISO image
-copyright copyright Specifies the copyright information for the ISO image
-hide-rr-moved Specifies that Rock Ridge moved files should be hidden

The upper table shows some options you can select. By default, mkisofs generates ISO-9660 file systems, but it also supports other formats such as Joliet and Rock Ridge extensions. These extensions provide additional features not present in the base ISO-9660 standard, such as longer filenames and POSIX file attributes. To enable Joliet extensions, you can use the "-J" flag when invoking mkisofs. Similarly, the "-R" flag enables Rock Ridge extensions. In addition to these extensions, mkisofs allows you to set various metadata for the disk image, such as volume names, publisher information, and even bootable attributes.

You can find mkisofs in most Linux distributions' package repositories under the same name.

  • On Ubuntu:

# apt-get install mkisofs

  • On CentOS:

# yum install mkisofs

There are many possibilities in order to customize an ISO. By modifying the ISO image, we can automatically partition the hard drives, install Linux, install several add-on packages, create user accounts, and set up the networking. In the following steps, we will see how to customize an existing ISO template.

What Is SystemBack?

SystemBack is a free and open-source backup and system recovery tool for Linux-based operating systems. It is designed to create system backups, which include the entire operating system, user data, and configuration settings. With SystemBack you can create bootable ISO images via a graphical user interface (GUI) that makes it user-friendly and accessible to users who may not be comfortable with command-line tools. Be aware that the development of SystemBack appeared to have slowed down in recent years, and it may not be actively maintained or updated to support the latest Linux distributions. In this article, SystemBack works without any issue with the Ubuntu version ubuntu-18.04.6-live-server-amd64.iso.

How To Create a Disk Image of the Host System

Let us assume we have installed Ubuntu (ubuntu-18.04.6-live-server-amd64.iso) on our machine and tailored the operating system. In this use case, the customized system boots automatically and does not have a boot menu.

Next, we want to create a bootable ISO image of the adjusted system in order to distribute the system to the client.

In the first place, create a system backup of the running system as follows:

  1. Create a SystemBack backup.
  2. Click on the "Live system create" option.
  3. Select the backup you created in Step 1 from the list of available backups.
  4. Configure system settings: You can customize various settings like the ISO file name, user accounts, hostname, and other boot options as needed.
  5. Click the "Create new" button to generate the live system ISO. SystemBack will compile the backup into a bootable image.

If you boot the generated ISO image, you will see the following boot menu created by SystemBack:

Creating Customized and Bootable Disk Images of Host Systems - DZone (1)

To fix this bug, we use mkisofs.

Therefore, we need to create a folder under /tmp where we specify the source directory test_iso where we save the files and folders of the generated ISO image.

Shell

mkdir /tmp/test_iso

In order to access and modify the contents of an ISO file, you can mount it as a device. Linux will treat it as a separate file system, and allow you to browse the files as you would normally browse the directory structure of your hard drive. The fastest way to mount an ISO image is via the command line. For that reason, let us jump into the source directory:

We execute the mount command in order to mount the generated ISO image:

Shell

mount -t iso9660 -o loop template_linux.iso /mnt/

According to the main page of the mount command: The option -t tells the kernel to attach the filesystem iso9660 found on the loop device. If no explicit loop device is mentioned (but just an option -o loop is given), then mount will try to find some unused loop device and use that and will set up the loop device such as /dev/loop1 to correspond to the generated ISO image, and then mount this device on /mnt.

We will see a warning: the generated ISO image is read-only. To modify the content of the generated ISO image, we need to copy the content into the source directory after we have switched to the folder /mnt:

Shell

cp -r /mnt/* /tmp/test_iso

Another command for copying the content of the ISO image to the source folder:

Shell

tar cf - . | (cd /tmp/test_iso; tar xfp -)

Now, we can adjust the isolinux config file to remove the boot menu and enable the automatic boot process.

In the last step, we will create a new bootable ISO image from the source folder. First, switch to the folder /tmp/test_isoand then execute the following command:

Shell

mkisofs -o custom_live_system.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -R -V "Custom Live System" .

Conclusion

Creating customized and bootable disk images with SystemBack and mkisofs is a powerful way to distribute pre-configured operating systems tailored to your needs. Whether you're a system administrator or developer, mastering this process will help you streamline deployments and ensure consistency across multiple systems.

Opinions expressed by DZone contributors are their own.

Creating Customized and Bootable Disk Images of Host Systems - DZone (2024)

FAQs

How do I make a bootable disk image? ›

Choose the menu "File > Properties" to set the iso file properties. Choose the menu "Action > Boot > Add Boot Information" to load a bootable image file. Click on the "Save" button on toolbar, or click on the "File > Save As..." menu. Save the bootable image file to ISO, BIN, or DAA format.

How to create a bootable ISO image in Linux? ›

Make Bootable USB From Linux GUI
  1. Plug in your USB drive and open GNOME Multi Writer. Start by clicking on the “Start Copying” button. ...
  2. Next, locate your ISO file and import it. Import the ISO file you wish to burn.
  3. Finally, let GNOME Multi Writer burn your ISO file to the USB.
Jan 8, 2024

How do I create a bootable system image? ›

Key Takeaways
  1. Open the System Backup Image Tool. ...
  2. Choose where you want to save the backup image.
  3. Select the drives to back up.
  4. Start the backup.
  5. Optionally, create a system repair disc that you can use to start your computer and restore a backup image.
Mar 20, 2023

How do I make a system disk bootable? ›

How to make a drive bootable via cloning (step-by-step)
  1. Choose "System Clone" to get started. Make sure the hard drive is detected by Windows. ...
  2. Select the target drive that you want to make it bootable. ...
  3. Overview of the operation and "Start Clone" ...
  4. Boot from the cloned hard drive.
Jul 24, 2024

How do I create an ISO image of my operating system? ›

On the Windows 10 download page, download the media creation tool by selecting Download now, then run the tool. In the tool, select Create installation media (USB flash drive, DVD, or ISO) for another PC > Next. Select the language, architecture, and edition of Windows, you need and select Next.

What makes an ISO image bootable? ›

Bootable Discs and USB Drives

ISO images are the foundation of a bootable CD, DVD or USB drive. However, the boot program must be added by using a utility program. For example, WinISO makes CDs and DVDs bootable from ISO images, while Rufus does the same for USB drives. See Rufus, ISO 9660, UDF, DMG and disk image.

How to create a bootable drive on Linux? ›

  1. Insert your USB drive. The first thing to do is insert your USB drive into the computer you installed UNetbootin on. ...
  2. Start UNetbootin. From your computer's desktop menu, click to launch the UNetbootin application.
  3. Select your distribution. ...
  4. Select your USB drive. ...
  5. Burn the image.
Aug 29, 2024

How do I Create a boot image? ›

Using the Configuration Manager Console, in the Software Library workspace, expand Operating Systems, right-click Boot Images, and select Create Boot Image using MDT. On the Package Source page, specify the path of an empty directory. The specified path must be a valid network path in the UNC format and click Next.

How to create bootable USB ISO image? ›

How to boot ISO using USB drive
  1. Download any third-party tool like Rufus, UltraISO, YUMI.
  2. Add the ISO image file into the tool.
  3. Insert the USB Drive to burn the ISO file. ...
  4. Once the ISO boot files are copied to the USB drive, you can insert them into the target computers for booting from ISO file.

How to make a disk image file? ›

Create a disk image from a disk or connected device
  1. In the Disk Utility app on your Mac, select a disk, volume or connected device in the sidebar.
  2. Choose File > New Image, then choose “Image from [device name]”.
  3. Enter a filename for the disk image, add tags if necessary, then choose where to save it.

How do I make a bootable image of Windows? ›

In the tool, select Create installation media (USB flash drive, DVD, or ISO) for another PC > Next. Select the language, architecture, and edition of Windows, you need and select Next. Select ISO file > Next, and the tool will create your ISO file for you.

Top Articles
ONE Gas hiring Clerk in Topeka, KS | LinkedIn
Pacific Gas and Electric Company hiring Troubleshooter in Fremont, CA | LinkedIn
Can Banks Take Your Money To Pay Off Debts? StepChange
Rachel Sheherazade Nua
Ffxiv Ixali Lightwing
Aflac on LinkedIn: Aflac Supplemental Insurance | 22 comments
Triple A Flat Tire Repair Cost
Academic Calendar Biola
Editado Como Google Translate
Saydel Botanica
FREE Houses! All You Have to Do Is Move Them. - CIRCA Old Houses
What Auto Parts Stores Are Open
Milk And Mocha Bear Gifs
Buhl Park Summer Concert Series 2023 Schedule
Localhotguy
Spicy Korean Gochujang Tofu (Vegan)
Short Swords Resource Pack (1.21.1, 1.20.1) - Texture Pack
Dangerous Cartoons Act - Backlash
Sophia Turner Derek Deso Instagram
Violent Night Showtimes Near The Riviera Cinema
2024 Coachella Predictions
Xsammybearxox
San Diego Terminal 2 Parking Promo Code
8 30 Eastern Standard Time
Pay Vgli
512-872-5079
Jen Chapin Gossip Bakery
Orileys Auto Near Me
Deerc De22 Drone Manual Pdf
Stuckey Furniture
Bank Of America Financial Center Irvington Photos
Fgo Spirit Root
Hinterlands Landmarks
Intoxalock Calibration Locations Near Me
Gunblood Unblocked 66
Daftpo
Orylieys
Rs3 Bis Perks
Filmy4 Web Xyz.com
Patriot Ledger Obits Today
Mercy Baggot Street Mypay
Bfads 2022 Walmart
What Is TAA Trade Agreements Act Compliance Trade Agreement Act Certification
What Happened To Daniel From Rebecca Zamolo
Smartmove Internet Provider
1 Filmy4Wap In
Uncg Directions
Leslie Pool Supply Simi Valley
Craigslist Pets Olympia
Siôn Parry: The Welshman in the red of Canada
Craigslist Apartments For Rent Imperial Valley
Two Soyjaks Pointing Png
Latest Posts
Article information

Author: Jamar Nader

Last Updated:

Views: 5440

Rating: 4.4 / 5 (75 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Jamar Nader

Birthday: 1995-02-28

Address: Apt. 536 6162 Reichel Greens, Port Zackaryside, CT 22682-9804

Phone: +9958384818317

Job: IT Representative

Hobby: Scrapbooking, Hiking, Hunting, Kite flying, Blacksmithing, Video gaming, Foraging

Introduction: My name is Jamar Nader, I am a fine, shiny, colorful, bright, nice, perfect, curious person who loves writing and wants to share my knowledge and understanding with you.