Sometimes you may need to create ISO image from CD in Linux. dd is a very useful command that allows you to easily format folders and files into CD/DVD/ISO images, and even copy them from one location to another. So you can use it to create backups, and hard drive installations. In this article, we will learn how to create an ISO image from CD in Linux. ISO disk images are files that act as replicas of CD/DVDs and do not require a physical disk to be present in order to be able to access its contents. You can simply load the ISO file into a virtual drive and be able to use it just as you use a CD/DVD. Often ISO files are also written to CD/DVD for portability.
How to Create ISO Image from CD in Linux
Here are the steps to create ISO image from CD/DVD in Linux.
1. Insert CD/DVD
Insert the CD/DVD into your physical drive. Do not mount it. Open terminal and run the following command to check if it has been mounted or not.
If your CD/DVD was mounted automatically, run the following command to unmount it.
$ sudo umount /dev/cdrom OR $ sudo umount /mnt/cdrom/
2. Create ISO Image
We will use dd command to create ISO image from CD/DVD. It is a regularly used tool by developers and system administrators to create disk images and backups. It is available by default in almost every Linux distribution.
But before you proceed, please create a backup of your CD/DVD to avoid accidental data loss.
Create ISO image from CD/DVD with the following command.
$ sudo dd if=/dev/cdrom of=/tmp/cd-image.iso
In the above command, you need to mention the cd partition /dev/cdrom as if option, and the target location of ISO image file as of option.
If you want to restore a disk partition from ISO image, swap the location of CD/DVD with ISO image in above command.
$ sudo dd if=/tmp/cd-image.iso of=/dev/cdrom
If you want to specify the block size while writing to ISO image, use bs option. First, we calculate number of blocks to be created for our ISO image.
$ blk=$(isosize -d 4096 /dev/sr0)
Next, we create ISO image with our desired number of blocks.
$ sudo dd if=/dev/sr0 of=/tmp/output.iso bs=4096 count=$blk status=progress
If you have created ISO image with the above command, use the following command to restore it from the image to disk. Here also, we mainly swap location of ISO image and CD/DVD partition.
$ sudo dd if=/path/to/isofile of=/dev/sdd bs=4096 conv=noerror
In this article, we have learnt how to create ISO image from CD/DVD using dd command in Linux. You can use it to create ISO’s from disks or even folders for that matter.
How to Export Pandas Dataframe to Multiple Excel Sheets
How to Export Pandas Dataframe to Excel
How to Export Pandas Dataframe to PDF
How to Run Python Script in Apache Server
Shell Script to Clear/Delete Log Files