RSS



Linux Quickies - copying a cd or dvd with a one line command

Wed, Sep 6, 2006

ArsGeek, Linux

Talk about it in our Forums

cracked

The little program that could, dd, has been around for several decades. It can do a lot of stuff but today we’re going to use it to copy a cd or dvd.


Please note that this isn’t really the best way to make a backup of your DVD collection. You can read about better ways to do that here and here. Also, only use this to make legal copies of stuff that you have a right to copy.

Ready? Here we go.

Stick a cd or dvd into your drive, and figure out where you want to put the image. For this example, we’ll use /home/user/image.iso.

dd if=/dev/cdrom of=/home/user/image.iso

That’s it. If tells dd that it’s not going to take stuff from standard input but rather will be copying a file. of tells it that it won’t be dumping stuff to the screen, but rather to a file as well. You’ll have to change the path and file name after ‘of’ to reflect something that exists on your computer.

geek out.

Click the icon, share the link:
  • Digg
  • del.icio.us
  • MisterWong
  • Furl
  • Reddit
  • Technorati
  • BlinkList
  • feedmelinks
  • PopCurrent
  • Blogosphere News
  • Facebook
  • Fark
  • Mixx
  • Slashdot

This post was written by:

arsgeek - who has written 1980 posts on ArsGeek.


Contact the author

3 Comments For This Post

  1. Paul Betts Says:

    Actually, if you use

    dd conv=noerror if=/dev/cdrom of=~/image.iso bs=128

    it will make a better attempt at reading CDs that are scratched (if it can’t read a sector, it’ll write zeros to the image, which may be alright depending on the info on the disk)

  2. arsgeek Says:

    Great suggestion! Thanks!

    geek out

  3. Saman Says:

    Also, you will want to make sure an exact amount of blocks is copied in order to get an exact image (this is because if the data on the disk is smaller than disk size, dd will do some padding of NULL values, hence an md5sum of the two disks won’t be the same.

    To get the number of blocks:

    1. mount the disk
    2. Do a ‘df’, and node the number of 1K blocks in the disk
    3. unmount the disk

    Then, run:

    dd if=/dev/dvd of=file.iso conv=noerror bs=2048 count=”numebr of 1-K blocks divided by 2″.

    You may want to look into the “readcd” program as well. Sometimes dd might fail where ‘readcd’ wont and vice/versa.

1 Trackbacks For This Post

  1. zean.no-ip.info » Linux Quickies - copying a cd or dvd with a one line command Says:

    [...] (more…)   [...]

Leave a Reply