3

I have created iso files by using two commands:

  • dd if=/dev/cdrom of=filename
  • cp /dev/cdrom filename

What's the difference between the two, both have worked for me.

Osama ALASSIRY
  • 794
  • 3
  • 7
  • 22

3 Answers3

8

For copying CDs then both are fine although I generally expliciatlly set the block size by doing

dd if=/dev/cdrom of=cdrom.iso bs=512

For other block devices then cp might not work if the block size on the device is unexpected.

From http://en.wikipedia.org/wiki/Dd_(Unix)

Note that an attempt to copy the entire disk image using cp may omit the final block if it is an unexpected length; dd will always complete the copy if possible.

ryanmjacobs
  • 103
  • 3
Nathan
  • 1,177
  • 6
  • 9
  • You should add the "conv=sync,notrunc" parameter from the wikipedia page. Else your quote is wrong. – David Schmitt May 07 '09 at 11:24
  • Sorry, my first command wasn't from wikipedia only the block quote. Updated text to reflect this. – Nathan May 07 '09 at 11:54
  • 3
    FYI, block size on CD-ROM is actually 2048 octects – derobert May 07 '09 at 17:57
  • Seems you learn something every day. I've always used 512 but it appears this dates back to SCSI days when most drivers were 512 or 2048. I'll use 2048 from now on. Thanks ! – Nathan May 07 '09 at 18:39
0

Using the dd command allows for a "byte-exact" copy of the specified input. If the dd command is used on a disk rather than the cdrom, it will be able to copy previously deleted files which cannot be seen by the cp command from the filesystem interface. But since you are using /dev/cdrom as the input (which doesn't have the same structure as a disk), there are no previously deleted files on the interface, so the commands should work exactly the same.

for more information: http://en.wikipedia.org/wiki/Dd_(Unix)

John T
  • 1,059
  • 1
  • 15
  • 19
  • no, i mean cp /dev/cdrom as an input. – Osama ALASSIRY May 07 '09 at 10:05
  • incorrect answer - /dev/cdrom is a block device, not a filesystem directory. /dev/cdrom *is* the disk structure. – Alnitak May 07 '09 at 11:50
  • You clearly can't read – John T May 07 '09 at 20:56
  • ok, I've slightly misunderstood your answer, but I *still* can't figure out what you meant in the first half of the last sentence. The comparison with a disk and mention of deleted files is very confusing. – Alnitak May 07 '09 at 21:23
  • From the wikipedia article "Using cp would not be possible because data from deleted files still physically present on a disk are not visible through the file system interface." And i said this isn't applicable to a cdrom because it does not retain information like a disk. – John T May 07 '09 at 21:56
  • Hence why both commands work the same – John T May 07 '09 at 21:57
0

There's effectively no difference, some very minor caveats aside.

Both dd and cp will read all blocks from the input source (the /dev/cdrom block device) and copy the whole CD-ROM to the destination file.

dd is however the "right" way of doing it.

Alnitak
  • 20,901
  • 3
  • 48
  • 81