linux中劃分硬碟的sd和hd是什麼意思?

接下來的描述可能是不準確的,請輕噴~linux中的硬碟是不是可以分為sd和hd,這裡的sd和hd分別是怎麼意思(上百度沒查到),他們是按照什麼規律分為sda,sdb,sdc,...,hda,hdb,...的?


謝 @啦嗦咪 邀。程序員不用百度。

關於/dev/hd*

By convention, IDE drives where given device names /dev/hdato /dev/hdd. Hard Drive A( /dev/hda) is the first drive and Hard Drive C( /dev/hdc) is the third.

A typical PC has two IDE controllers, each of which can have two drives connected to it. For example, /dev/hdais the first drive (master) on the first IDE controller and /dev/hddis the second (slave) drive on the second controller (the fourth IDE drive in the computer).

So, typically, a computer with IDE controller can accomodate 4 drives: /dev/hda (primary master), /dev/hdb (primary slave), /dev/hdc (secondary master), /dev/hdd (secondary slave). Some (rare) Mother Boards have more than two controllers, some addition cards can also have controllers, these are numbered following the alphabet, but one have to figure out what real names are given for his particular hardware.

關於/dev/sd*

Now all the rotating hard drives uses the same names as the old SCSI controllers, that is "s" in place of "h", so /dev/sda, and so on. The number of drives depends on the number of controllers on the Mother Board or the extended boards. Usually 4 are available. What will be the number of a drive is up to the controller card and the way it"s read by the kernel, so difficult to say at first.

References:

[1] Drive Naming in Linux


這個問題,要從磁碟介面說起。

話說,個人計算機常見的磁碟介面分為兩種,分別是IDE介面和SATA介面,目前主流的已經是SATA介面了。我們稱可連接到IDE介面的設備成為IDE設備,不管是磁碟還是光碟。

以IDE介面來說,主機會提供兩個IDE介面,每個介面連接兩個設備,所以最多可以連接到4個設備。每個介面的IDE設備又有Master和Slave之分。4個設備的文件名如表所示。

再以SATA介面來說,由於SATA/USB/SCSIA等磁碟介面都是使用SCSI模塊來驅動的,因此這些介面的磁碟設備文件名都是使用SCSI模塊來驅動的,因此這些介面的磁碟設備文件名都是/dev/sd[a-p]的格式。但是與IDE介面不同的是,SATA/USB介面的磁碟設備文件名根本就沒有一定的順序,順序是由Linux內核檢測到磁碟的順序決定的。

上面只是大概說一下,若想了解關於磁碟分區的來龍去脈,請參見我的博客:磁碟分區(一)和磁碟分區(二)。

歡迎大家指正!


其實這是可以man到的...

man sd/hd..


推薦閱讀:

請問台式一個月不關機可行嗎?
Linux下編寫腳本Shell和Python的區別?
現在研一,想學運維,有些疑惑求解答?
Linux數據,做/var黨,還是/opt黨,還是/usr/local黨,還是/home黨呢?
學神IT培訓怎麼樣?

TAG:Linux | Linux系統管理 | 硬碟 | Linux開發 | Linux運維 |