linx 设备名字来由 sd sr sg st
2018-09-18 13:52 ljtcnblogs 阅读(1352) 评论(0) 编辑 收藏 举报转载保留:http://blog.csdn.net/luoweifeng1989/archive/2011/05/17/6426193.aspx
一直不知道 sda sdb sr0 这些名字的前两两个字母是什么意思
- > > On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton
- > > <derek@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.
- Loïc had it right.
- But you should read the code from orbit. It's the only way to make sure.
- >From a 2.4 kernel source
- drivers/scsi/sd.c
- static struct Scsi_Device_Template sd_template = {
- name:"disk",
- tag:"sd",
- scsi_type:TYPE_DISK, <== "d" for disk
- major:SCSI_DISK0_MAJOR,
- /*
- * Secondary range of majors that this driver handles.
- */
- min_major:SCSI_DISK1_MAJOR,
- max_major:SCSI_DISK7_MAJOR,
- blk:1,
- detect:sd_detect,
- init:sd_init,
- finish:sd_finish,
- attach:sd_attach,
- detach:sd_detach,
- init_command:sd_init_command,
- };
- drivers/scsi/st.c
- static struct Scsi_Device_Template st_template =
- {
- name:"tape",
- tag:"st",
- scsi_type:TYPE_TAPE, <== "t" for tape
- major:SCSI_TAPE_MAJOR,
- detect:st_detect,
- init:st_init,
- attach:st_attach,
- detach:st_detach
- };
- drivers/scsi/sr.c
- static struct Scsi_Device_Template sr_template =
- {
- name:"cdrom",
- tag:"sr",
- scsi_type:TYPE_ROM, <== "r" for ROM
- major:SCSI_CDROM_MAJOR,
- blk:1,
- detect:sr_detect,
- init:sr_init,
- finish:sr_finish,
- attach:sr_attach,
- detach:sr_detach,
- init_command:sr_init_command
- };
- >From a 2.6 kernel source
- drivers/scsi/sr.c
- MODULE_DESCRIPTION("SCSI cdrom (sr) driver");
- MODULE_LICENSE("GPL");
- MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);
- MODULE_ALIAS_SCSI_DEVICE(TYPE_ROM);
- MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);
- --
- ubuntu-users mailing list
- ubuntu-users@lists.ubuntu.com
- Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
可以看出:
sr代表 scsi + rom
sd代表 scsi + disk
sg 代表 scsi + generic
st代表 scsi + tape
/dev/cdrom 只是/dev/sr0的符号链接
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 地球OL攻略 —— 某应届生求职总结
· 提示词工程——AI应用必不可少的技术
· Open-Sora 2.0 重磅开源!
· 周边上新:园子的第一款马克杯温暖上架