# which device is my cdrw?

## r8dhex

i've just setup my cdrw on my laptop, cdrecord -scanbus shows my cdrw. i've also emerged k3b, and i ran its setup tool to configure the cdrw. i've sucessfully burned some cdrw's.

now i'm confused... when i look at k3b's options, i see that my drive is at: 

```
/dev/scsi/host0/bus0/target0/lun0/generic
```

in /etc/fstab k3b setup automatically adds this line:

```
/dev/scsi/host0/bus0/target0/lun0/cd
```

when i want to mount a cd, this doesn't work:

```
mount /mnt/cdrom
```

this does work, however

```
mount /dev/sr0 /mnt/cdrom
```

or adding a line for /dev/sr0 to fstab allows me to just type 'mount /mnt/cdrom'

looking at the symbolic links:

```
/dev/sg0 -> /dev/scsi/host0/bus0/target0/lun0/generic

/dev/sr0 -> /dev/scsi/host0/bus0/target0/lun0/cd
```

so now i have 2 lines in fstab which point to the same thing. and i have another device (generic) which is used by k3b (and by definition, cdrecord). i found out that i didn't have to mount any of the devices when i want to burn something, but i don't understand the relationships between these 2 devices and the symlinks to them. 

which one is the correct device to leave in fstab? am i correct in guessing that /dev/scsi/.../generic is used only for writing and /dev/scsi/.../cd is used only for reading? why doesn't 'mount /mnt/cdrom' work unless i add /dev/sr0 to fstab?

sorry for asking too many questions, but none of the documentation i've read has adequate explanations for these  :Smile: 

----------

## BonezTheGoon

Well first of all the reason your cdrw is showing up as /dev/scsi/host0/bus0/target0/lun0/generic is because it has to be a 'scsi' device to be able to burn (if it is actually an IDE drive, like I'd bet it is on a laptop, your kernel is using "IDE-SCSI Emulation" to make the burner appear as a SCSI device).

Next the reason /dev/sd0 is the same as /dev/scsi/host0/bus0/target0/lun0/generic is just as you said because it is a link.

You do not need to mount the drive when burning because there is not actually a filesystem on the CD-R at the time you first put it in, cdrecord controls your cdrw at the hardware level to create the disc.

As long as you are using devfs (which in a default Gentoo 1.2 install you are) you should be able to easily add /dev/cdroms/cdrom0 into your fstab and then you will be able to mount it and unmount it easily (this is also another link though, but I use it and like it).

The reason you cannot say "mount /mnt/cdrom" without an entry in the fstab is because the OS has no idea what you are asking to mount onto /mnt/cdrom.  Once you have an entry in your /etc/fstab then the mount command can "fill-in the blanks" of your command with information found in the fstab.  Also you might like to add the 'users' option in your fstab so that users other than root can mount the cd-rw.  Be sure also that any user that will be burning cd's is in the 'cdrw' group.

So far as I know there are no devices in linux for scsi that are specific to reading while another is specific to writing.  So cd and generic should be the same device (I think, but I don't know much about SCSI in linux--only scsi emulation.)

Hope that helps!

Regards,

BonezTheGoon

----------

