dd is a perfect tool for copy a file, converting and formatting according to the operands. dd command works on Linux and a Unix-like system whose primary job is to convert and copy files. It can create exact CD-ROM ISO image or create a new CD/DVD iso image. This is useful for making a backup, as well as for hard drive installations, require a working the use of ISO images.
How do I use dd command on Linux to create an ISO image?
Put CD or DVD into CDROM/DVDROM drive.
Do not mount CD/DVD. Verify if the cd is mounted or not with the mount command:
If CD/DVD was mounted automatically unmount it with the help of umount command:
$ sudo umount /dev/cdrom
$ sudo umount /mnt/cdrom/
Warning: Reading and writing partitions or data from it has the VERY REAL potential to cause DATA LOSS. Use common sense. BACKUP ANYTHING YOU DO NOT WANT TO LOSE! Wrong command line option can result in DATA LOSS.
Create CD-ROM/DVD ISO image with dd command:
$ sudo dd if=/dev/cdrom of=/tmp/cdimg1.iso
- if=/dev/cdrom: Read data from /dev/cdrom in raw format
- of=/tmp/cdimg1.iso>: Write to FILE named /tmp/cdimg1.iso i.e. create an ISO image
How to create an ISO disk image from a CD-ROM, DVD or Blu-ray disk
First get blocksize. I am using /dev/dvdrom or /dev/sr0. Use the grave accent (`cmd`) or ($(cmd)) to perform a command substitution:
blocks=$(isosize -d 2048 /dev/sr0)
Now run dd command and display progress bar while using dd command:
$ sudo dd if=/dev/sr0 of=/tmp/output.iso bs=2048 count=$blocks status=progress
Now you can use cdimg1.iso or output.iso for hard disk installation or as a backup copy of CD/DVD media. Please note that dd command is standard UNIX command and you should able to create backup/iso image under any UNIX like operating system. You can restore hard disk drive from a previously generated ISO image using the dd command itself:
$ sudo dd if=/path/to/my/iso.img of=/dev/sdd bs=4096 conv=noerror