/dev/sr0 與/dev/cdrom

來源:互聯網
上載者:User

 

與/dev/cdrom

Luo Weifeng 2011-5-17

轉載保留:http://blog.csdn.net/luoweifeng1989/archive/2011/05/17/6426193.aspx

 

 

這個問題貌似困擾了我一小會,因為要查看cd的mount point,使用mount命令查看後竟然是裝置/dev/sr0掛載到了我準備的磁碟mount point,我試著umount了這個裝置,使用/dev/cdrom 掛載了後竟然沒有區別,然後查看裝置節點,發現如下:

原來/dev/cdrom 只是一個到sr0的符號連結。那麼sr到底代表什麼呢,google了一下發現了一個郵件清單裡邊也有個哥們鬱悶這事。摘錄如下:

><br />><br />> On Wed, Nov 4, 2009 at 10:17 PM, Derek Broughton<br />> <derek@pointerstop.ca> wrote:<br />> Verde Denim wrote:<br />><br />> > On Tue, Nov 3, 2009 at 9:34 AM, Derek Broughton<br />> > <derek@pointerstop.ca>wrote:<br />> ><br />> ><br />><br />> > Translation - I don't know either... lol<br />><br />><br />> Actually, I'd already said that - and suggested "raw" as a<br />> wild guess. But<br />> I was intrigued that Detlef thought that knowing what it stood<br />> for would<br />> prevent errors, since I really can't imagine how most of us<br />> would need to<br />> know it.<br />> --<br />> derek<br />><br />> And knowing the acronym definitions probably won't help the learning<br />> too much, either.<br />> But, according to the Linux SCSI sub-system documentation I have, it<br />> would have to stand for _SCSI_ _READ_ since it is a cd drive that is<br />> designated read-only. For generic operations on the same device, it<br />> would map to sg0 (_SCSI_ _GENERIC_) in order to gain the write perm.<br />> Apparently all of the devices like /dev/sr0, /dev/st0, /dev/nst0x map<br />> to an sg device for generic operations.<br />> Although _raw_ seems to be a good logical choice.<br />Loïc had it right.<br />But you should read the code from orbit. It's the only way to make sure.<br />>From a 2.4 kernel source<br />drivers/scsi/sd.c<br />static struct Scsi_Device_Template sd_template = {<br />name:"disk",<br />tag:"sd",<br />scsi_type:TYPE_DISK, <== "d" for disk<br />major:SCSI_DISK0_MAJOR,<br />/*<br />* Secondary range of majors that this driver handles.<br />*/<br />min_major:SCSI_DISK1_MAJOR,<br />max_major:SCSI_DISK7_MAJOR,<br />blk:1,<br />detect:sd_detect,<br />init:sd_init,<br />finish:sd_finish,<br />attach:sd_attach,<br />detach:sd_detach,<br />init_command:sd_init_command,<br />};<br />drivers/scsi/st.c<br />static struct Scsi_Device_Template st_template =<br />{<br />name:"tape",<br />tag:"st",<br />scsi_type:TYPE_TAPE, <== "t" for tape<br />major:SCSI_TAPE_MAJOR,<br />detect:st_detect,<br />init:st_init,<br />attach:st_attach,<br />detach:st_detach<br />};<br />drivers/scsi/sr.c<br />static struct Scsi_Device_Template sr_template =<br />{<br />name:"cdrom",<br />tag:"sr",<br />scsi_type:TYPE_ROM, <== "r" for ROM<br />major:SCSI_CDROM_MAJOR,<br />blk:1,<br />detect:sr_detect,<br />init:sr_init,<br />finish:sr_finish,<br />attach:sr_attach,<br />detach:sr_detach,<br />init_command:sr_init_command<br />};<br />>From a 2.6 kernel source<br />drivers/scsi/sr.c<br />MODULE_DESCRIPTION("SCSI cdrom (sr) driver");<br />MODULE_LICENSE("GPL");<br />MODULE_ALIAS_BLOCKDEV_MAJOR(SCSI_CDROM_MAJOR);<br />MODULE_ALIAS_SCSI_DEVICE(TYPE_ROM);<br />MODULE_ALIAS_SCSI_DEVICE(TYPE_WORM);<br />--<br />sktsee<br />--<br />ubuntu-users mailing list<br />ubuntu-users@lists.ubuntu.com<br />Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users<br /> 

可以看出:

sr代表 scsi + rom

sd代表 scsi + disk

sg 代表 scsi + generic

st代表 scsi + tape

 

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.