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:
$ 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:
- How to verify the images using an md5sum program
- Extracting particular file from ISO file after installation
- How do I write CD at Debain Linux command prompt?
- Splits directory into multiple file with equal size for ISO burning purpose
- Man pages: dd(1)
🐧 17 comments so far... add one ↓
Category | List of Unix and Linux commands |
---|---|
File Management | cat |
Firewall | Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04 |
Network Utilities | dig • host • ip • nmap |
OpenVPN | CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04 |
Package Manager | apk • apt |
Processes Management | bg • chroot • cron • disown • fg • jobs • killall • kill • pidof • pstree • pwdx • time |
Searching | grep • whereis • which |
User Information | groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w |
WireGuard VPN | Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04 |
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.
Very good!
Thanks
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
just don’t do it.
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!
Thanks
Thank You
its great to work in the terminal
i love Linux
You just made my day 🙂
Thnx
Why is it necessary to unmount the CD-ROM first?
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.
It works fine. Thanks.
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.
It works, thanks!
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! 😀
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!
You better add some blocksize parameter using bs=$something or it will take quite a while…
This has cemented my love of *nix. I already knew that you could mount disk images using
mount
, but the using ofdd
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).