How to create an ISO image from a CD or DVD

This article describes how to create an ISO image file from a CD or DVD. As usual with linux, there is more than one way to accomplish a task. But as we are all big fans of the linux command line, we will be using the command line tool dd. But first we need to know the device our optical drive is assigned to. We can use lsblk to figure that out.

$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 223,6G  0 disk 
├─sda1   8:2    0   8,0G  0 part [SWAP]
├─sda2   8:3    0 215,2G  0 part /
sr0     11:0    1 227,8M  0 rom

In our case it seems to be /dev/sr0. Often there are also some symbolic links pointing to the optical drive. We can use them too, of course.

$ ls -l /dev/cdrom /dev/dvd
lrwxrwxrwx 1 root root 3 Jan 25 13:40 /dev/cdrom -> /dev/sr0
lrwxrwxrwx 1 root root 3 Jan 25 13:40 /dev/dvd -> /dev/sr0

After we made sure that the device is not mounted anywhere, we can actually start the copy process using dd.

$ dd if=/dev/cdrom of=/tmp/image.iso

Depending on the drive’s speed and the size of the image, the copy process might take some time. We can gain insight into the program’s progress by sending the USR1 signal to the dd process. In a separate shell we can find out the pid of the running dd process and send it the USR1 signal.

$ ps awx | grep dd
3359 pts/3    D+     0:00 dd if=/dev/cdrom of=/tmp/image.iso
$ kill -USR1 3359

Sending dd the USR1 signal will make it print the current copy progress on the original shell, e.g.:

161505+0 records in
161504+0 records out
82690048 bytes (83 MB) copied, 48,8422 s, 1,7 MB/s