can't read raw CD device

Nikos Vassiliadis nvass at teledomenet.gr
Thu May 24 13:46:52 UTC 2007


On Thursday 24 May 2007 15:59, Incoming Mail List wrote:
> Hello,
>
> I'm trying to understand why I cannot read my CD drive directly from a
> 'c' program using the read(2) system call, or even using the dd(1)
> command.  As you will see, I have both the acd0 and cd0 devices since
> I have atapicam configured in the kernel.
>
> I can mount cdrom media using mount() and access data via the cd9660
> file system, so I know the drive and the media are not the problem.
>
> #dd if=/dev/acd0 of=/dev/null count=20
> dd: /dev/acd0: Invalid argument
> 0+0 records in
> 0+0 records out
> 0 bytes transferred in 0.000163 secs (0 bytes/sec)
>
> #dd if=/dev/cd0 of=/dev/null count=20
> dd: /dev/cd0: Invalid argument
> 0+0 records in
> 0+0 records out
> 0 bytes transferred in 0.000179 secs (0 bytes/sec)

You have to define the sector size explicitly, otherwise
your read(2)s will fail. You can use a multiple of 2048.
dd uses by default a 512 byte length buffer.

root:0:~# dd if=/dev/acd0 bs=2048 count=10 of=/dev/null 
10+0 records in
10+0 records out
20480 bytes transferred in 4.110981 secs (4982 bytes/sec)

That's for the so-called "data" CDs, the block size you
have to use for audio CDs is 2352.

HTH, Nikos


More information about the freebsd-questions mailing list