[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: How to tell a CD's filesystem format? (SOLVED)

I wrote:
Is there an easy way in Linux to determine whether a compact disc is an audio CD or a data CD, and if it's a data CD, which filesystem is on it?

One would think that the "file" command would say, but it just tells you that the CDROM device file is a device file.

I turns out that if the CD has a filesystem on it, "file -s" will tell me which one. file's man page says that it avoids reading the contents special files by default because read accesses to physical devices might have unfortunate consequences.

$ file -s /dev/scd0
/dev/scd0: ISO 9660 CD-ROM filesystem data 'TURBOTAX98                '

But file won't identify audio CDs:

/dev/scd0: ERROR: cannot read `/dev/scd0' (Input/output error)

I installed cdparanoia with "apt-get cdparanoia" and found that the --query option will print out the table of contents:

Table of contents (audio tracks only):
track        length               begin        copy pre ch
  1.    23280 [05:10.30]        0 [00:00.00]    no   no  2

If the CD in the drive isn't an audio CD, cdparanoia reports "unable to open disc".

I still don't know of a single program that will make a positive identification of both kinds of CDs, but both file and cdparanoia provide non-zero exit status upon error, so it should be very simple to write a small shell script to do it.

Rippit the Ogg Frog

Reply to: