Linux creating CD-ROM ISO images from a CD, DVD, Blu-ray

in Categories FreeBSD, Howto, Linux, Solaris, UNIX last updated December 24, 2017

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.

Creating an ISO image from a CD, DVD, or BD on a linux

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:
$ mount

If CD/DVD was mounted automatically unmount it with the help of umount command:
$ sudo umount /dev/cdrom
OR
$ 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
Where,

  • 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

See also:

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Share this on (or read 17 comments/add one below):

17 comment

  1. This has cemented my love of *nix. I already knew that you could mount disk images using mount, but the using of dd to make a disk image. That was the best bit. I have the need to make alot of images, for various reasons. And its faster than on windows. (In my experience anyway).

  2. This just made my day, thank you. For some reason, Brasero wouldn’t copy the cd, but dd did it without error.

    Thank you very much!

  3. I didn’t know i could do this directly 😛

    I used to do:
    dd if=/dev/cdrom1 of=./image.img
    img2iso image.img image.iso

    Thank you! 😀

  4. I have a Dual booted pc (Linux/XP) I would like to take the Windows XP partition and create an ISO for a VM. Is it possible? I expect when XP wakes up in a VM environment there might be a few problems with hardware recognition but that can be addressed later.

    1. Using this method is reading the bits straight from the device. If it is mounted, then the device will be “in use” as it is already mounted to another folder. You could still use dd to make an image of the mounted location (i.e., /media/mounteddisk) but then it would be like burning a folder to disk instead of getting the exact formatting of a CD.

  5. Thanks!
    Iam using fedora 14 and all the gui programs are buggy, crashing and sometimes they have problems with certain CDs,but
    dd… and the other command line tools.. they never leaves me in the lurch!

  6. Hello friends
    I need your help in installing redhat linux5 on my laptop compaq presario cq40 having windows vista operating system. when I am installing linux then it is not recognizing my partition and dvdram drive asking for the location of linux image. I have formated one partition with ext3 but it is not seen by windows. how ever when loading linux it detects my hard disk but not finding image. I don’t know how to load the image of linux in cd from windows vista operating system. if you can help me in this regard then I will remain thankful to you.
    thanks
    OP Singh

  7. Where,

    if=/dev/cdrom: Read from /dev/cdrom (raw format)
    of=/tmp/cdimg1.iso: write to FILE cdimg1.iso i.e. create an ISO image

    FOR CORRECTION:

    if=/dev/cdrom (will not be constant) cdrom name will change, check for the correct name.

    Have a question? Post it on our forum!