dd for backing up those old CD-ROMs

Tux

Today we unearthed yet another old CD-ROM. We used to backup all our family photos and videos onto CDs and DVDs in the good old days of slow ADSL connections and expensive or non-existent cloud storage.

These days, when I come across these CDs and DVDs, I use this quick hack to send them into the cloud.

Step 1

Pop them into a DVD or CD reader. I have one attached to my trusty Fedora laptop.

Step 2

Determine the Linux device file for the DVD/CD reader.

In my case, the CD/DVD auto-mounts. So a simple ‘df ‘ gives the device name /dev/sr0 – highlighted in the transcript below.

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        4.0M     0  4.0M   0% /dev
tmpfs           1.9G  5.0M  1.9G   1% /dev/shm
tmpfs           763M  1.8M  761M   1% /run
/dev/dm-0       118G  113G  4.3G  97% /
tmpfs           1.9G   92K  1.9G   1% /tmp
/dev/dm-0       118G  113G  4.3G  97% /home
/dev/sda2       974M  201M  706M  23% /boot
/dev/sda1       599M   14M  585M   3% /boot/efi
tmpfs           382M  160K  381M   1% /run/user/1000
/dev/sr0        552M  552M     0 100% /run/media/user1/PhotoCD1
$ 

Step 3

Use ‘dd’ to copy the CD/DVD’s contents onto a location on your computer.

‘dd’ is part of the GNU Coreutils package and should be installed by default on every Linux instance.

$ dd if=/dev/sr0 of=/home/user1/PhotoCD1.img bs=2048
282424+0 records in
282424+0 records out
578404352 bytes (578 MB, 552 MiB) copied, 237.454 s, 2.4 MB/s
$ 

Note that specifying the block size of the transfer using ‘bs=2048’ is optional. It simply refers to the block size you want to use to buffer your I/O transfer. The operating system should auto-select this. I chose to do it out of (old-school) habit because /dev/sr0 was reporting a 2048-byte optimal I/O size (see highlighted lines):

$ sudo fdisk -l /dev/sr0
Disk /dev/sr0: 551.61 MiB, 578404352 bytes, 282424 sectors
Disk model: DVDRW  DU8A6SH  
Units: sectors of 1 * 2048 = 2048 bytes
Sector size (logical/physical): 2048 bytes / 2048 bytes
I/O size (minimum/optimal): 2048 bytes / 2048 bytes
$ 

Step 4

Do with the resultant ‘virtual’ CD/DVD (/home/user1/PhotoCD1.img in the example above) as you will.

I usually confirm first that it is what I think it is:

$ file /home/user1/PhotoCD1.img
/home/user1/PhotoCD1.img: ISO 9660 CD-ROM filesystem data 'PhotoCD1'
$ 

Then I test mounting it to and navigating to it on my laptop (double-clicking in your default file manager program should do the trick, then examine its contents).

Finally I copy it to my chosen online backup storage.

References

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: