How to clone DVD/CD in ubuntu

How to clone DVD/CD in ubuntu

In this post, I introduce how to clone a DVD/CD to a PC, and re-mount the disc from the clone on the PC (without the physical disc).
I also show how to bypass the CSS (Content Scramble System) protection.

Part 1: clone the disc

  • Figure out the device bound by the CD/DVD: df. Sample output
Filesystem     1K-blocks      Used Available Use% Mounted on
udev             8011328         0   8011328   0% /dev
tmpfs            1607336      2208   1605128   1% /run
/dev/sda2       47799020  33128520  12212696  74% /
tmpfs            8036676    463680   7572996   6% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs            8036676         0   8036676   0% /sys/fs/cgroup
/dev/loop1         15104     15104         0 100% /snap/gnome-characters/375
/dev/loop2          8832      8832         0 100% /snap/canonical-livepatch/90
/dev/loop3          3840      3840         0 100% /snap/gnome-system-monitor/123
/dev/loop4         96128     96128         0 100% /snap/core/8935
/dev/loop5        164096    164096         0 100% /snap/gnome-3-28-1804/116
/dev/loop7         56064     56064         0 100% /snap/core18/1650
/dev/loop6          1024      1024         0 100% /snap/gnome-logs/81
/dev/loop0          4480      4480         0 100% /snap/gnome-calculator/704
/dev/loop8         91264     91264         0 100% /snap/core/8268
/dev/loop10        56320     56320         0 100% /snap/core18/1705
/dev/loop9         15104     15104         0 100% /snap/gnome-characters/495
/dev/loop11         4352      4352         0 100% /snap/gnome-calculator/544
/dev/loop12         9344      9344         0 100% /snap/canonical-livepatch/95
/dev/loop13        56192     56192         0 100% /snap/gtk-common-themes/1502
/dev/loop14       160512    160512         0 100% /snap/gnome-3-28-1804/110
/dev/loop15        49536     49536         0 100% /snap/gtk-common-themes/1474
/dev/loop16         1024      1024         0 100% /snap/gnome-logs/93
/dev/loop17         3840      3840         0 100% /snap/gnome-system-monitor/135
/dev/sda1         944120    123332    755612  15% /boot
/dev/sda4      167223824 128534400  30125200  82% /home
/dev/sdb2         523248      6152    517096   2% /boot/efi
tmpfs            1607332        20   1607312   1% /run/user/121
tmpfs            1607332        52   1607280   1% /run/user/1000
/dev/sr0         7823484   7823484         0 100% /media/transang/my-disc

The last line /dev/sr0         7823484   7823484         0 100% /media/transang/my-disc indicates that the DVD is bound to /dev/sr0.

  • Now, determine the device's logic block size and size with isoinfo -d -i /dev/sr0. Sample output:
CD-ROM is in ISO 9660 format
System id: 
Volume id: MY_DISC
Volume set id: UNDEFINED
Publisher id: 
Data preparer id: 
Application id: 
Copyright File id: 
Abstract File id: 
Bibliographic File id: 
Volume set size is: 1
Volume set sequence number is: 1
Logical block size is: 2048
Volume size is: 3912007
NO Joliet present
**BAD RRVERSION (0)
NO Rock Ridge present

Remember the block size of 2048 in the line Logical block size is: 2048.

  • Now, clone the disc to a file on the local PC. For example, if the output file name is my-disc.iso:
dd if=/dev/sr0 of=my-disc.iso bs=2048

This command usually takes a long time to run. After this command, the my-disc.iso file will contain the disc content. You can now safely remove the physical DVD/CD.

Sample output:

3912007+0 records in
3912007+0 records out
8011790336 bytes (8.0 GB, 7.5 GiB) copied, 717.571 s, 11.2 MB/s

If there is an error in this step, skip and navigate to part 2 of this post.

  • To replicate the DVD/CD's content (without the physical DVD/CD).

If you want to read raw data of the disc: Open the Disks application in ubuntu (gnome-disk-utility). Select menu -> Attach Disk Image... -> Navigate to and select my-disc.iso.

If you want to play the content of the disc (like autoplay feature when disc inserted): install VLC. Right-click to the iso file, select Open with, choose VLC.

Done.


Part 2: css protected disc

If the disc is protected (with css: Content Scramble System), there would be the following error:

dd: error reading '/dev/sr0': Input/output error
9550+0 records in
9550+0 records out
19558400 bytes (20 MB, 19 MiB) copied, 1.43275 s, 13.7 MB/s

Disc integrated css requires a handshake protocol before start data transfer. In order to make dd work. You should first open the disc, read any of its content by any program which supports css handshake (usually via the libdvdcss library). My recommendation is the popular VLC player.

Start VLC, from the File menu, select Open disc...

Choose your disc and click Play.

Usually, VLC automatically detects your disc and sets the default configuration.

If the Play button is disabled, try selectting another radio box (e.g. Blu-ray), then select back to the original selection (DVD).

After VLC opens your disc, re-run the dd command. Once dd starts running, your can pause VLC to avoid simultaneous reading and improve the copy speed.

Buy Me A Coffee