What does the letter »r« stand for in /dev/sr0?
Rashkae
ubuntu at tigershaunt.com
Thu Nov 5 15:31:23 UTC 2009
Loïc Grenié wrote:
> 2009/11/5 Verde Denim <tdldev at gmail.com>:
>>
>> On Wed, Nov 4, 2009 at 10:17 PM, Derek Broughton <derek at pointerstop.ca>
>> wrote:
>>> Verde Denim wrote:
>>>
>>>> On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
>>>> <derek at pointerstop.ca>wrote:
>>>>
>>>>
>>>> Translation - I don't know either... lol
>>> Actually, I'd already said that - and suggested "raw" as a wild guess.
>>> But
>>> I was intrigued that Detlef thought that knowing what it stood for would
>>> prevent errors, since I really can't imagine how most of us would need to
>>> know it.
>>> --
>>> derek
>>>
>> And knowing the acronym definitions probably won't help the learning too
>> much, either.
>> But, according to the Linux SCSI sub-system documentation I have, it would
>> have to stand for _SCSI_ _READ_ since it is a cd drive that is designated
>> read-only. For generic operations on the same device, it would map to sg0
>> (_SCSI_ _GENERIC_) in order to gain the write perm. Apparently all of the
>> devices like /dev/sr0, /dev/st0, /dev/nst0x map to an sg device for generic
>> operations.
>> Although _raw_ seems to be a good logical choice.
>
> I seriously doubt it: a "raw" device in Unix jargon, is a character device.
> /dev/sr0 is a block device and a corresponding raw device would be called
> /dev/rsr0, would be a character device, and it would be impossible to read
> non-multiple of the sector size (2048 bytes for CDs, 512 for most hdd). I
> don't remember if "raw" devices go through page cache or not (probably
> not). So I strongly doubt it is a raw device.
>
> Loïc
>
Simply looking at the relative udev rules and comments thereof:
(These are from Gutsy, there may have been changes, I'm too lazy to verify)
# SCSI CD-ROM devices use /dev/scdN now
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", NAME="scd%n"
# Raw block devices need to be /dev/raw/*
SUBSYSTEM=="raw", KERNEL=="raw[0-9]*", NAME="raw/%k"
# Compatibility symlinks for /dev/scd* devices
SUBSYSTEMS=="scsi", KERNEL=="sr[0-9]*", SYMLINK+="%k"
Interpretation: sr is simply how the kernel identifies SCSI CD-ROM
devices, whatever the r kinda stands for, more or less irrelevant.
The proper device to refer to in /dev is is scd#. the sr symlink exists
only for backwards compatibility. However, if you have multiple cdrom
devices, they can switch around just like sd devices. It's probably a
good idea to use /dev/cdrom[#] since those device names should be
persistent.
More information about the ubuntu-users
mailing list