當前位置:首頁 » 服務存儲 » 硬碟怎麼存儲位元組
擴展閱讀
webinf下怎麼引入js 2023-08-31 21:54:13
堡壘機怎麼打開web 2023-08-31 21:54:11

硬碟怎麼存儲位元組

發布時間: 2022-12-09 15:49:16

硬碟怎麼存儲的按什麼方式存儲

與普通硬碟比較,擁有以下優點:
1. 啟動快,沒有電機加速旋轉的過程。
2. 不用磁頭,快速隨機讀取,讀延遲極小。根據相關測試:兩台電腦在同樣配置的電腦下,搭載固態硬碟的筆記本從開機到出現桌面一共只用了18秒,而搭載傳統硬碟的筆記本總共用了31秒,兩者幾乎有將近一半的差距。
3. 相對固定的讀取時間。由於定址時間與數據存儲位置無關,因此磁碟碎片不會影響讀取時間。
4. 基於DRAM的固態硬碟寫入速度極快。
5. 無噪音。因為沒有機械馬達和風扇,工作時噪音值為0分貝。某些高端或大容量產品裝有風扇,因此仍會產生噪音。
6. 低容量的基於快閃記憶體的固態硬碟在工作狀態下能耗和發熱量較低,但高端或大容量產品能耗會較高。
7. 內部不存在任何機械活動部件,不會發生機械故障,也不怕碰撞、沖擊、振動。這樣即使在高速移動甚至伴隨翻轉傾斜的情況下也不會影響到正常使用,而且在筆記本電腦發生意外掉落或與硬物碰撞時能夠將數據丟失的可能性降到最小。
8. 工作溫度范圍更大。典型的硬碟驅動器只能在5到55攝氏度范圍內工作。而大多數固態硬碟可在-10~70攝氏度工作,一些工業級的固態硬碟還可在-40~85攝氏度,甚至更大的溫度范圍下工作。
9. 低容量的固態硬碟比同容量硬碟體積小、重量輕。但這一優勢隨容量增大而逐漸減弱。直至256GB,固態硬碟仍比相同容量的普通硬碟輕。
固態硬碟與傳統硬碟比較,擁有以下缺點:
1. 成本高。每單位容量價格是傳統硬碟的5~10倍(基於快閃記憶體),甚至200~300倍(基於DRAM)。
2. 容量低。目前固態硬碟最大容量遠低於傳統硬碟。固態硬碟的容量仍在迅速增長,據稱IBM已測試過4TB的固態硬碟。
3. 由於不像傳統硬碟那樣屏蔽於法拉第籠中,固態硬碟更易受到某些外界因素的不良影響。如斷電(基於DRAM的固態硬碟尤甚)、磁場干擾、靜電等。
4. 寫入壽命有限(基於快閃記憶體)。一般快閃記憶體寫入壽命為1萬到10萬次,特製的可達100萬到500萬次,然而整台計算機壽命期內文件系統的某些部分(如文件分配表)的寫入次數仍將超過這一極限。特製的文件系統或者固件可以分擔寫入的位置,使固態硬碟的整體壽命達到20年以上。
5. 基於快閃記憶體的固態硬碟在寫入時比傳統硬碟慢很多,也更易受到寫入碎片的影響。
6. 數據損壞後難以的恢復。傳統的磁碟或者磁帶存儲方式,如果硬體發生損壞,通過目前的數據恢復技術也許還能挽救一部分數據。但如果固態硬碟發生損壞,幾乎不可能通過目前的數據恢復技術在失效(尤其是基於DRAM的)、破碎或者被擊穿的晶元中找回數據。
7. 根據實際測試,使用固態硬碟的筆記本電腦在空閑或低負荷運行下,電池航程短於使用5400RPM的2.5英寸傳統硬碟。
8. 基於DRAM的固態硬碟在任何時候的能耗都高於傳統硬碟,尤其是關閉時仍需供電,否則數據丟失。
9. 據用戶反映,使用低廉的MLC的固態硬碟在Windows操作系統下運行比傳統硬碟慢。這是由於Windows操作系統的文件系統機制不適於固態硬碟。在Linux下無此問題。
本文來自: 電腦知識大全() 詳細出處參考:

Ⅱ 硬碟是怎麼來存儲數據的

硬碟不是直接存儲我們現在人看到的數據,計算機中,通過2進制,將數據轉化為可以用2進製表示的數字數據,再對應機器的高電平低電平等可以用兩種機器物理狀態的狀態。

硬碟儲存數據的原理和盒式磁帶類似,只不過盒式磁帶上存儲是模擬格式的音樂,而硬碟上存儲的是數字格式的數據。寫入時,磁頭線圈上加電,在周圍產生磁場,磁化其下的磁性材料;電流的方向不同,所以磁場的方向也不同,可以表示 0 和 1 的區別。

讀取時,磁頭線圈切割磁場線產生感應電流,磁性材料的磁場方向不同,所以產生的感應電流方向也不同。

(2)硬碟怎麼存儲位元組擴展閱讀

硬碟使用注意事項:

1、在工作時不能突然關機。

硬碟當硬碟開始工作時,一般都處於高速旋轉之中,如果我們中途突然關閉電源,可能會導致磁頭與碟片猛烈磨擦而損壞硬碟,因此要避免突然關機。關機時一定要注意麵板上的硬碟指示燈是否還在閃爍,只有在其指示燈停止閃爍、硬碟讀寫結束後方可關閉計算機的電源開關。

2、防止灰塵進入。

灰塵對硬碟的損害是非常大的,這是因為在灰塵嚴重的環境下,硬碟很容易吸引空氣中的灰塵顆粒,使其長期積累在硬碟的內部電路元器件上,會影響電子元器件的熱量散發,使得電路元器件的溫度上升,產生漏電或燒壞元件。

3、要防止溫度過高或過低。

溫度對硬碟的壽命也是有影響的。硬碟工作時會產生一定熱量,使用中存在散熱問題。溫度以20~25℃為宜,過高或過低都會使晶體振盪器的時鍾主頻發生改變。溫度還會造成硬碟電路元器件失靈,磁介質也會因熱脹效應而造成記錄錯誤。

Ⅲ 硬碟與U盤存儲數據的通俗原理

U盤是以Flash Memory 作為存儲單元,是一種可擦寫的內存,其載體是半導體晶元。普通的內存是一種RAM,斷電後即丟失所有數據,而Flash Memory 則必須通過加電才能改變數據,所以可以
長時間保持數據。

傳統硬碟實際上就是一個高密度的磁碟,是在一塊硬質基板上塗覆了磁粉,通過讀寫磁頭產生的磁場改變磁碟上的每一個磁軌記錄單元內磁體方向的變化進行讀寫處理。說白了就是一張類似原來的3寸、5寸磁碟,不過是密度、可靠性等大大提高而已。

(3)硬碟怎麼存儲位元組擴展閱讀

相對而言傳統的機械硬碟由於技術上比較成熟,針對其恢復的技術也比較成熟

1、機械硬碟在刪除格式化時並沒有對底層數據做清零的操作,只是在某個扇區做了一個標識,在出現邏輯故障時數據恢復的成功率是非常高的,當然前提是沒有寫入新的數據到這個硬碟或分區上。

2、機械硬碟在出現,硬碟電路板壞,硬碟有壞道,硬碟固件區問題,硬碟磁頭損壞,只要沒有傷到或只是輕微劃傷硬碟的存儲碟片,那麼數據恢復的成功率是可以達到90%以上。

Ⅳ 硬碟是怎麼來存儲數據的

硬碟儲存數據的原理和盒式磁帶類似,只不過盒式磁帶上存儲是模擬格式的音樂,而硬碟上存儲的是數字格式的數據。寫入時,磁頭線圈上加電,在周圍產生磁場,磁化其下的磁性材料;電流的方向不同,所以磁場的方向也不同,可以表示 0 和 1 的區別。

讀取時,磁頭線圈切割磁場線產生感應電流,磁性材料的磁場方向不同,所以產生的感應電流方向也不同。


光碟和硬碟儲存原理不一樣,直接比較其儲存密度和介質的體積之間的關系沒有意義,例如硬碟和光碟都可以在更高的工藝水平和技術下大幅提高自己的儲存密度。



簡單說來,光儲是靠光線傳播的差異來儲存信息,包括反射光的強度,相位變化等,磁儲是靠磁體中磁疇(小磁針)的指向來記錄信息的。

Ⅳ 扇區、磁碟塊、頁。磁碟是如何存儲數據的:磁碟的物理結構

扇區,sector

硬碟的讀寫以扇區為基本單位。磁碟上的每個磁軌被等分為若干個弧段,這些弧段稱之為扇區。硬碟的物理讀寫以扇區為基本單位。通常情況下每個扇區的大小是 512 位元組。linux 下可以使用 fdisk -l 了解扇區大小:

$ sudo /sbin/fdisk -l

Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors

Units: sectors of 1 * 512 = 512 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disklabel type: dos

Disk identifier: 0x7d9f5643

其中 Sector size,就是扇區大小,本例中為 512 bytes。

注意,扇區是磁碟物理層面的概念,操作系統是不直接與扇區交互的,而是與多個連續扇區組成的磁碟塊交互。由於扇區是物理層面的概念,所以無法在系統中進行大小的更改。

磁碟塊,IO Block

文件系統讀寫數據的最小單位,也叫磁碟簇。扇區是磁碟最小的物理存儲單元,操作系統將相鄰的扇區組合在一起,形成一個塊,對塊進行管理。每個磁碟塊可以包括  2、4、8、16、32 或 64 個扇區。磁碟塊是操作系統所使用的邏輯概念,而非磁碟的物理概念。磁碟塊的大小可以通過命令 stat /boot 來查看:

$ sudo stat /boot

  File: /boot

  Size: 4096        Blocks: 8          IO Block: 4096   directory

Device: 801h/2049d  Inode: 655361      Links: 3

Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)

Access: 2019-07-06 20:19:45.487160301 +0800

Modify: 2019-07-06 20:19:44.835160301 +0800

Change: 2019-07-06 20:19:44.835160301 +0800

Birth: -

其中 IO Block 就是磁碟塊大小,本例中是 4096 Bytes,一般也是 4K。

為了更好地管理磁碟空間和更高效地從硬碟讀取數據,操作系統規定一個磁碟塊中只能放置一個文件,因此文件所佔用的空間,只能是磁碟塊的整數倍,那就意味著會出現文件的實際大小,會小於其所佔用的磁碟空間的情況。

test2.txt是一個只包含一個字母的文本文檔。它的理論大小是一個位元組,但是由於系統的磁碟塊大小是4KB(文件的最小存儲大小單位),所以test2.txt占據的磁碟實際空間是4KB

操作系統不能對磁碟扇區直接定址操寫,主要原因是扇區數量龐大,因此才將多個連續扇區組合一起操作。磁碟塊的大小是可以通過blockdev命令更改的。

頁,page

內存的最小存儲單位。頁的大小通常為磁碟塊大小的 2^n 倍,可以通過命令 getconf PAGE_SIZE 來獲取頁的大小:

$sudo getconf PAGE_SIZE

4096

本例中為 4096 Bytes,與磁碟塊大小一致。

總結兩個邏輯單位:

頁,內存操作的基本單位

磁碟塊,磁碟操作的基本單位

命令索引

扇區大小,fdisk -l

磁碟塊大小,stat /boot

內存頁大小,getconf PAGE_SIZE

硬碟是如何存儲數據的:硬碟的物理結構

提示:硬碟分為機械硬碟和固態硬碟這2種。這里只講解機械硬碟,固態硬碟的存儲另當別論。

要想知道硬碟是如何存儲數據的,就先明白硬碟的物理結構。

1、名稱機械硬碟,由於信息載體為磁性物質,故又稱磁碟。 2、硬碟主要結構在硬碟盒裡面其實是由許許多多的圓形碟片、機械手臂、磁頭與主軸馬達所組成的。 3、工作情形實際的數據都是寫在具有磁性物質的碟片上,而讀寫主要是通過在機械手臂上的磁頭(head)來達成。實際運行時, 主軸馬達讓碟片轉動,然後機械手臂可伸展讓磁頭在碟片上頭進行讀寫的動作。

4、各主要部件說明(1)碟片和主馬達主馬達就是一個小電機,作用是讓碟片轉動起來。通常數據寫入當然就是以圓圈轉圈的方式讀寫啰!

對於機械硬碟,最重要的結構是這些兩面塗有磁性材料的碟片,在工作時會以每分鍾7200轉的速度旋轉。碟片的作用是記錄數據,在碟片上有序的排列了很多的小顆粒材料,它們都是磁性物質,可以被永久磁化和改變磁極,這兩個磁極就分別表示了計算機二進制中的0和1。由於碟片是轉動後讀寫數據的,所以,當初設計就是在類似碟片同心圓上面切出一個一個的小區塊,這些小區塊整合成一個圓形,讓機器手臂上的磁頭去存取。這個小區塊就是磁碟的最小物理儲存單位,稱之為扇區 (sector),那同一個同心圓的扇區組合成的圓就是所謂的磁軌(track)。 扇區容量:原本硬碟的扇區都是設計成 512Byte(即0.5KB) 的容量,但因為近期以來硬碟的容量越來越大,為了減少數據量的拆解,所以新的大容量硬碟已經有 4KByte(即4KB)的扇區設計! 由於單一碟片的容量有限,因此有的硬碟內部會有兩個以上的碟片喔!由於磁碟裡面可能會有多個碟片,因此在所有碟片上面的同一個磁軌可以組合成所謂的柱面 (cylinder)。 數據存儲在碟片上的一個個扇區中。

1)1個扇區(磁軌)可存儲512Bytes的數據量;

2)一個平面中同一半徑下的多個扇區共同組成了1個磁軌;

3)一個碟片有2個盤面,每個盤面都對應一個磁頭,負責讀寫數據;

4)一個硬碟可以有多個碟片;

5)同一半徑下的多個磁軌共同組成了1個柱面。

(2)磁頭和機械手臂機械手臂的作用是控制來回磁頭移動。磁頭的作用是在碟片上讀寫數據。磁頭通過改變碟片上小顆粒磁性物質的磁極方向來完成寫入數據的功能,通過感知碟片上磁性物質的磁極方向來完成讀取數據的功能。

5、扇區中是如何表示01數據的?

硬碟是在硬質碟片(一般是鋁合金,以前 IBM 也嘗試過使用玻璃)上塗敷薄薄的一層鐵磁性材料。這些磁粉被劃分成稱為磁軌的若干個同心圓,在每個同心圓的磁軌上就好像有無數的任 意排列的小磁鐵,它們分別代表著0和1的狀態。當這些小磁鐵受到來自磁頭的磁力影響時,其排列的方向會隨之改變。利用磁頭的磁力控制指定的一些小磁鐵方 向,使每個小磁鐵都可以用來儲存信息。寫入時,磁頭線圈上加電,在周圍產生磁場,磁化其下的磁性材料;電流的方向不同,所以磁場的方向也不同,可以表示 0 和 1 的區別。讀取時,磁頭線圈切割磁場線產生感應電流,磁性材料的磁場方向不同,所以產生的感應電流方向也不同。

================================優美的分割線===================================

延伸:固態硬碟的存儲原理(微觀)

接下來來講固態硬碟,相比較於機械硬碟裡面的各種機械結構,固態硬碟就沒有太多的機械機構;它主要是靠FLASH晶元來作為儲存數據的介質;由主控晶元來承擔數據的中轉,還有調配數據儲存在快閃記憶體晶元上面

FLASH晶元儲存數據的方式也不是太難理解,就是FLASH晶元裡面分出了很多儲存單元,這些儲存單元裡面有電子的位置;當一顆電子的位置裡面沒有存放電子,它就是0;如果存放了電子,它就是1 參考:

https://zhuanlan.hu.com/p/117375905 https://www.cnblogs.com/andy9468/p/11091115.html

Ⅵ 2020-12-02 硬碟如何存儲文件

系統中所有內容是以文件(文件夾是特殊的文件)存在的,而文件分為屬性(元信息)和內容兩部分,磁碟一部分被操作系統虛擬為塊用來存儲數據,同時也分出一部分虛擬為Inode用來存儲文件屬性,這樣磁碟就分為塊區和inode區。

扇區:磁碟存儲數據的最小物理單元,每個扇區很小512位元組左右。
讀取數據:OS要想讀取磁碟數據,首先讓磁頭徑向尋道(最慢),然後旋轉磁碟(較快),使磁頭到達目標扇區,開始讀取數據。

磁碟塊:OS日常工作中,一個扇區的512位元組數據很小,不足以支撐絕大部分工作場景,所以需要頻繁讀取單個扇區,而磁碟讀取數據速度相對CPU處理太慢了,所以讀磁碟時一次就多拿出幾個扇區(臨近的,無需耗費額外時間)的數據,於是在OS層面邏輯虛擬出磁碟塊(簇)的概念,一個磁碟塊一般對應8個連續扇區(也可4、16個等,由OS決定),這樣OS層面就使用磁碟塊作為最小數據存儲單元。
這樣的好處當然是更高效,缺點則是會?

inode:用於存儲文件的元信息(除名稱外的所有屬性,名稱存在文件夾的內容中)
Inode number is also known as index number. An inode is a unique number assigned to files and directories while it is created. The inode number will be unique to entire filesystem.

Disk inodes contain the following information:

Owner identifier
Type of file (regular, directory, character or block device)
Access permissions
Times and dates
· file creation time

· last file access time

· last inode modification time

Number of links to the file
Array of pointers to data blocks on disk
File size (in bytes, sometimes also in blocks)

文件:
上文提及文件屬性存在磁碟inode區的inode(每個都有編號)內,而內容存儲在塊區的塊中。

文件夾:
作為特殊文件,其組織文件及目錄,屬性也是存在inode內,而存儲的內容是一個包含多個{ 文件名:對應inode Id} 的列表,內容亦存在塊區的塊中。

這樣在OS中查看一個文件(比如/etc/fstab)的內容,大概是:
首先OS獲取到根目錄的inodeId >在inode區中讀取到其屬性(某項是內容所在塊)>在塊區讀取到根目錄內容>在內容中找到名為/etc對應發inodeId>/etc在inode區的屬性>讀取到塊中/etc的內容(包含/etc/fstab對應inodeId)>/etc/fstab Inode Id > 在inode區讀取到/etc/fstab屬性 >/etc/fstab塊。

可能有誤,望指點。

Within each file system, the mapping from names to blocks is handled through a structure called an i-node. There's a pool of these things near the "bottom" (lowest-numbered blocks) of each file system (the very lowest ones are used for housekeeping and labeling purposes we won't describe here). Each i-node describes one file. File data blocks (including directories) live above the i-nodes (in higher-numbered blocks).

Every i-node contains a list of the disk block numbers in the file it describes. (Actually this is a half-truth, only correct for small files, but the rest of the details aren't important here.) Note that the i-node does not contain the name of the file.

Names of files live in directory structures. A directory structure just maps names to i-node numbers. This is why, in Unix, a file can have multiple true names (or hard links); they're just multiple directory entries that happen to point to the same i-node.

refer: https://unix.stackexchange.com/questions/432655/why-does-using-indirect-pointers-in-inodes-not-incur-the-same-amount-of-space

less:by direct list blocks in node?.
large :by two-level indirect block
larger : multi-level indirect block.

The original hierarchy of the inodes levels works roughly like this:

You can store one or a few block numbers directly in the inode. This means you use a few bytes more for the inode, but for small files, you don't have to allocate a complete block, which is mostly empty.

The next level is one indirection: You allocate a block to store the block pointers. Only the address of this indirect block is stored in the inode. This doesn't use somehow "less space", and most filesystems, even early ones, worked like that (have a pointer near the inode/filename which points to a block, which stores the block numbers of the file).

But what do you do when the space in this block runs out? You have to allocate another block, but where do you store the reference to this block? You could just add those references to the inode, but to store largers files, the inode would get large. And you want small inodes, so as many as possible inodes can fit into a single block (less disk access to read more inodes).

So you use a two-level indirect block: You just add one pointer to the inode, then you have a whole block to store pointers to indirect blocks, and the indirect blocks store the block address of the file itself.

And so on, you can add higher-level indirect blocks, or stop at some stage, until you reach the maximal size of a file possible with the structure you want.

So the point is not "use up less space in total", but "use a scheme that uses blocks efficiently for the expected distribution a files wrt. to size, i.e. many small files, some larger files, and very few huge files".

Page tables on the other hand work very differently.

Edit

To answer the questions in the comment:

Data blocks are of fixed sizes (originally 512 bytes, IIRC), which is a multiple of the block size of the underlying harddisks. So data block size can't "decrease".

As I tried to describe above, the whole point of having the inodes not use up too much space is to make inode access faster (or, alternatively, make caching inodes use up less memory - back then when the unix file system with inodes was invented, computers had a lot less memory than today). It's not about somehow saving space in total. As you say yourself, everything has to be stored somewhere, and if it doesn't use up space at location X, it will use up space at location Y.

Just adding a variable number of block pointers to the inode is not practical, because the inode must take up a fixed amount of space - you want to use the inode number to calculate the block address and the offset inside the block where the inode information is stored. You can't do that if every inode has a different size. So there must be some form of indirection.

Page tables work differently because hardware implements them differently - that's just how it is. The hierarchy has a fixed depth, always the same (though sometimes configurable. And while reading a block from disk is slow, that doesn't matter for page tables. So the design issues are completely different.

http://www.cems.uwe.ac.uk/~irjohnso/coursenotes/lrc/internals/filestore/fs3.htm

Assuming, for the purposes of illustration, that each disk data block is 1024 bytes in size, then these ten data block pointers will allow files to be created that are up to 10 Kb in size. As you can see, for the large majority of files it should be possible to access the data with nothing more than a direct lookup required to find the data block that contains any particular data byte.

With this scheme, once a file has grown to 10 Kb, there are only three block pointers in the inode left to use, whatever the eventual size of the file. Obviously, some new arrangement must be found so that the three remaining block pointers will suffice for any realistic file size, while at the same time not degrading the data access time too much.

This goal is achieved by using the idea of indirect block pointers. Specifically, when an 11th data block needs to be allocated to the file, the 11th inode block pointer is used, but instead of pointing to the block which will contain the data, the 11th pointer is a single indirect pointer which points to a data block filled with a list of direct block pointers. In our example, if we assume that a data block number is a 32-bit value, then a list of 256 of them will fit into the single indirect block. This list will point directly to the data blocks for the next 256 Kb of our file. This means that with 11 block pointers in the inode, files of up to 266 Kb (10 + 256) can be created. True, it takes a little longer to access the data beyond the first 10 Kb in the file, but it takes only one extra disk block read to find the position on the disk of the required data.

For files bigger than 266 Kb the double indirect (12th) inode block pointer is used. This is the same idea as the previous inode pointer except that the double indirect pointer points to a list of pointers in a data block, each of which is itself a single indirect block pointer which points to a list of 256 direct block pointers. This means that the 12th inode block pointer gives access to the next 65536 Kb (256x256) of data in our file.

By now, you should be able to spot the pattern and see that when the file grows bigger than 64 Mb (actually 65802 Kb), the inode's 13th data block pointer will be used, but this time as a triple indirect pointer, which will give access to a staggering 16 Gb (256x256x256 Kb) of extra file space. A single file bigger than 16Gb sounds huge. However, even though the calculation we have just done suggests that this file size is possible with the inode layout as given, in fact there are other factors which limit the maximum size of a file to a smaller value than this. For example, the size of a file, in bytes, is stored separately in its inode in a field of type unsigned long. This is a 32-bit number which limits the size of a file to 4 Gb, so that 13 data block pointers in an inode really are enough.

10.4. How a file gets looked up
Now we can look at the file system from the top down. When you open a file (such as, say, /home/esr/WWW/ldp/fundamentals.xml) here is what happens:

Your kernel starts at the root of your Unix file system (in the root partition). It looks for a directory there called 『home』. Usually 『home』 is a mount point to a large user partition elsewhere, so it will go there. In the top-level directory structure of that user partition, it will look for a entry called 『esr』 and extract an i-node number. It will go to that i-node, notice that its associated file data blocks are a directory structure, and look up 『WWW』. Extracting that i-node, it will go to the corresponding subdirectory and look up 『ldp』. That will take it to yet another directory i-node. Opening that one, it will find an i-node number for 『fundamentals.xml』. That i-node is not a directory, but instead holds the list of disk blocks associated with the file.

The surface area of your disk, where it stores data, is divided up something like a dartboard — into circular tracks which are then pie-sliced into sectors. Because tracks near the outer edge have more area than those close to the spindle at the center of the disk, the outer tracks have more sector slices in them than the inner ones. Each sector (or disk block ) has the same size, which under modern Unixes is generally 1 binary K (1024 8-bit bytes). Each disk block has a unique address or disk block number .

Unix divides the disk into disk partitions . Each partition is a continuous span of blocks that's used separately from any other partition, either as a file system or as swap space. The original reasons for partitions had to do with crash recovery in a world of much slower and more error-prone disks; the boundaries between them rece the fraction of your disk likely to become inaccessible or corrupted by a random bad spot on the disk. Nowadays, it's more important that partitions can be declared read-only (preventing an intruder from modifying critical system files) or shared over a network through various means we won't discuss here. The lowest-numbered partition on a disk is often treated specially, as a boot partition where you can put a kernel to be booted.

Each partition is either swap space (used to implement virtual memory ) or a file system used to hold files. Swap-space partitions are just treated as a linear sequence of blocks. File systems, on the other hand, need a way to map file names to sequences of disk blocks. Because files grow, shrink, and change over time, a file's data blocks will not be a linear sequence but may be scattered all over its partition (from wherever the operating system can find a free block when it needs one). This scattering effect is called fragmentation .

Within each file system, the mapping from names to blocks is handled through a structure called an i-node . There's a pool of these things near the "bottom" (lowest-numbered blocks) of each file system (the very lowest ones are used for housekeeping and labeling purposes we won't describe here). Each i-node describes one file. File data blocks (including directories) live above the i-nodes (in higher-numbered blocks).

Every i-node contains a list of the disk block numbers in the file it describes. (Actually this is a half-truth, only correct for small files, but the rest of the details aren't important here.) Note that the i-node does not contain the name of the file.

Names of files live in directory structures . A directory structure just maps names to i-node numbers. This is why, in Unix, a file can have multiple true names (or hard links ); they're just multiple directory entries that happen to point to the same i-node.

In the simplest case, your entire Unix file system lives in just one disk partition. While you'll see this arrangement on some small personal Unix systems, it's unusual. More typical is for it to be spread across several disk partitions, possibly on different physical disks. So, for example, your system may have one small partition where the kernel lives, a slightly larger one where OS utilities live, and a much bigger one where user home directories live.

The only partition you'll have access to immediately after system boot is your root partition , which is (almost always) the one you booted from. It holds the root directory of the file system, the top node from which everything else hangs.

The other partitions in the system have to be attached to this root in order for your entire, multiple-partition file system to be accessible. About midway through the boot process, your Unix will make these non-root partitions accessible. It will mount each one onto a directory on the root partition.

For example, if you have a Unix directory called <tt class="filename">/usr</tt>, it is probably a mount point to a partition that contains many programs installed with your Unix but not required ring initial boot.

Ⅶ 硬碟是怎麼存儲數據的啊

【硬碟存儲數據方式】硬碟是在硬質碟片(一般是鋁合金,以前
IBM
也嘗試過使用玻璃)上塗敷薄薄的一層鐵磁性材料。硬碟儲存數據的原理和盒式磁帶類似,只不過盒式磁帶上存儲是模擬格式的音樂,而硬碟上存儲的是數字格式的數據。寫入時,磁頭線圈上加電,在周圍產生磁場,磁化其下的磁性材料;電流的方向不同,所以磁場的方向也不同,可以表示
0

1
的區別。讀取時,磁頭線圈切割磁場線產生感應電流,磁性材料的磁場方向不同,所以產生的感應電流方向也不同。
不論是什麼計算機文件,歌曲、視頻、圖片、文檔等等,都是以一個二進制的序列存在的,也就是很多個"10010001110011......"這樣的東西,硬碟上的存儲的文件實際上就是存儲著這些0和1的序列。硬碟的磁頭能夠按照指令讀取相應位置的信號,並且能夠改變指定位置的磁場方向,這就是數據的讀和寫。

Ⅷ 磁碟存儲容量計算

磁碟空間按照一定的磁碟陣列排布方法,有序且很規則得劃分為若干個扇區,然後再把其中的所有存儲介質的電離子清除,使之上面不管有無數據,都清零。

在格式化中,要插入一些停頓位,寫入一些輔助位,使得格式化後的容量小於格式化前的容量。磁碟格式化後能存儲有用信息的總量稱為存儲容量,其計算公式如下:

存儲容量 = n×t×s×b

其中n為保存數據的總盤面數;t為每面磁軌數;s為每道的扇區數;b為每個扇區存儲的位元組數。

(8)硬碟怎麼存儲位元組擴展閱讀

磁碟的存儲時間包括尋道時間和等待時間。尋道時間(查找時間,seek time)為磁頭移動到目標磁軌所需要的時間(movable-head disk),對於固定磁頭磁碟而言,無需移動磁頭,只需選擇目標磁軌對應的磁頭即可。等待時間為等待讀寫的扇區旋轉到磁頭下方所用的時間。

一般選用磁軌旋轉一周所用時間的一半作為平均等待時間。尋道時間由磁碟機的性能決定,目前主流硬碟典型的AST(average seek time)一般在10ms左右,而轉速則有2400r/min,5400r/min,7200r/min,等等.軟盤轉速較慢,一般只有360r/min(因為磁頭與盤面接觸性讀寫)。

磁碟的數據傳輸速率是指磁頭找到地址後,單位時間寫入或讀出的位元組數:

R = TB÷T

其中TB為一個磁軌上記錄的位元組數,T為磁碟每轉一圈所需的時間,R為數據傳輸速率。

Ⅸ 硬碟是如何存儲信息的

常見的分兩種硬碟:機械硬碟,固態硬碟。機械硬碟內部有電機驅動碟片,碟片高速運轉,磁頭負責在碟片上讀寫數據。固態硬碟靠電流讀寫快閃記憶體顆粒,類似於你的U盤,但它比U盤速度更快。