Linux 磁碟重整與否 - Linux

By Linda
at 2009-07-19T13:22
at 2009-07-19T13:22
Table of Contents
在請教問題之前, 先提供幾個網頁:
http://linux.vbird.org/linux_basic/0230filesystem.php
http://en.wikipedia.org/wiki/Defragmentation
http://0rz.tw/UFo9P
http://phorum.study-area.org/index.php?action=printpage;topic=10368.0
在鳥哥裡面提到, 由於 Ext2 是索引式檔案系統,基本上不太需要
常常進行磁碟重組的。
在 Tanenbaum 的 << Modern Operating Systems, 2e >> 裡面提到
Linux 一開始的 file system 是使用 Minix 的 file system
而現今在使用的 ex2 file system 可以說是 Minix file system 的衍生
, 但本質上也都是使有 inode(index node) 作為管理, 即鳥哥所說的
"索引式檔案系統" (index file system)
http://en.wikipedia.org/wiki/Inode
相對於"索引式檔案系統"的應該是"鏈節式檔案系統"(linked list allocation)
, 最著名的應該是 FAT(file allocation table), 但實際上應為 linked list
allocation using an index
http://en.wikipedia.org/wiki/File_Allocation_Table
現在問題來了:
inode 的原理是需要開啟檔案時, 將目的檔案的 inode 從硬碟載入, 藉以知
道檔案本身的內容是存在硬碟的哪個 block, 因為開一個檔案需要從 root 不斷的
往目的檔案所在的資料夾讀取, 所以可能需要很多次的硬碟讀取
為此使用了 caching (詳細情形可參考 J.Bath 的 <<The Design
of The Unix Operating System>>) 來加速。
而 FAT 則是把整個 FAT 都放在記憶體中, 因此不需要額外的硬碟讀取便可找
到目標檔案位於哪些 block(只要開機掛載時讀取)
總結以上, 我們可以發現 FAT 其實沒有磁碟重整的必要, 因為它整個 FAT 都在
記憶體裡面,相對的將 inode 的目錄與子目錄所在的 block 重整, 或許還可以加速
-----------------------------------------------------------------------
而事實上, 兩種 file system 其實都可能會造成檔案在硬碟中不連續配置(這是為
了排除 fragmentation 採用了 block 的方式所造成的後遺症), 因此對於硬碟一次
可以讀取大量 block 的特性,其實是很不利的。
總結這部份, 如果為了支援 block 一次可以讀取大量 block 的特性, 兩種 file
system 都應該要進行磁碟重組
那為甚麼網路上大家都說 windows 的 file system 要磁碟重組,而 Linux 的不大
需要呢??
感謝大家的回答 <(__)>
--
http://linux.vbird.org/linux_basic/0230filesystem.php
http://en.wikipedia.org/wiki/Defragmentation
http://0rz.tw/UFo9P
http://phorum.study-area.org/index.php?action=printpage;topic=10368.0
在鳥哥裡面提到, 由於 Ext2 是索引式檔案系統,基本上不太需要
常常進行磁碟重組的。
在 Tanenbaum 的 << Modern Operating Systems, 2e >> 裡面提到
Linux 一開始的 file system 是使用 Minix 的 file system
而現今在使用的 ex2 file system 可以說是 Minix file system 的衍生
, 但本質上也都是使有 inode(index node) 作為管理, 即鳥哥所說的
"索引式檔案系統" (index file system)
http://en.wikipedia.org/wiki/Inode
相對於"索引式檔案系統"的應該是"鏈節式檔案系統"(linked list allocation)
, 最著名的應該是 FAT(file allocation table), 但實際上應為 linked list
allocation using an index
http://en.wikipedia.org/wiki/File_Allocation_Table
現在問題來了:
inode 的原理是需要開啟檔案時, 將目的檔案的 inode 從硬碟載入, 藉以知
道檔案本身的內容是存在硬碟的哪個 block, 因為開一個檔案需要從 root 不斷的
往目的檔案所在的資料夾讀取, 所以可能需要很多次的硬碟讀取
為此使用了 caching (詳細情形可參考 J.Bath 的 <<The Design
of The Unix Operating System>>) 來加速。
而 FAT 則是把整個 FAT 都放在記憶體中, 因此不需要額外的硬碟讀取便可找
到目標檔案位於哪些 block(只要開機掛載時讀取)
總結以上, 我們可以發現 FAT 其實沒有磁碟重整的必要, 因為它整個 FAT 都在
記憶體裡面,相對的將 inode 的目錄與子目錄所在的 block 重整, 或許還可以加速
-----------------------------------------------------------------------
而事實上, 兩種 file system 其實都可能會造成檔案在硬碟中不連續配置(這是為
了排除 fragmentation 採用了 block 的方式所造成的後遺症), 因此對於硬碟一次
可以讀取大量 block 的特性,其實是很不利的。
總結這部份, 如果為了支援 block 一次可以讀取大量 block 的特性, 兩種 file
system 都應該要進行磁碟重組
那為甚麼網路上大家都說 windows 的 file system 要磁碟重組,而 Linux 的不大
需要呢??
感謝大家的回答 <(__)>
--
Tags:
Linux
All Comments

By Madame
at 2009-07-21T15:35
at 2009-07-21T15:35

By Anonymous
at 2009-07-25T05:33
at 2009-07-25T05:33

By Carol
at 2009-07-29T09:47
at 2009-07-29T09:47

By Wallis
at 2009-07-31T14:19
at 2009-07-31T14:19

By Oscar
at 2009-08-04T10:31
at 2009-08-04T10:31

By Eartha
at 2009-08-04T11:57
at 2009-08-04T11:57

By Lily
at 2009-08-06T19:06
at 2009-08-06T19:06

By Mia
at 2009-08-09T07:01
at 2009-08-09T07:01

By Anonymous
at 2009-08-12T14:58
at 2009-08-12T14:58

By Enid
at 2009-08-16T10:43
at 2009-08-16T10:43

By Mia
at 2009-08-21T07:12
at 2009-08-21T07:12

By Joe
at 2009-08-24T10:48
at 2009-08-24T10:48

By Ophelia
at 2009-08-26T08:27
at 2009-08-26T08:27

By Barb Cronin
at 2009-08-31T04:49
at 2009-08-31T04:49

By Annie
at 2009-08-31T17:39
at 2009-08-31T17:39

By Dinah
at 2009-09-05T04:36
at 2009-09-05T04:36

By Vanessa
at 2009-09-08T02:34
at 2009-09-08T02:34

By Gary
at 2009-09-10T07:08
at 2009-09-10T07:08

By Thomas
at 2009-09-13T10:11
at 2009-09-13T10:11

By Enid
at 2009-09-16T03:19
at 2009-09-16T03:19

By Oliver
at 2009-09-17T19:04
at 2009-09-17T19:04

By Brianna
at 2009-09-19T22:45
at 2009-09-19T22:45

By Andy
at 2009-09-20T07:54
at 2009-09-20T07:54

By Lily
at 2009-09-23T19:06
at 2009-09-23T19:06

By Andy
at 2009-09-25T23:28
at 2009-09-25T23:28

By Elvira
at 2009-09-26T16:34
at 2009-09-26T16:34

By Vanessa
at 2009-09-28T02:59
at 2009-09-28T02:59

By Annie
at 2009-09-30T11:36
at 2009-09-30T11:36

By John
at 2009-10-01T16:19
at 2009-10-01T16:19

By Robert
at 2009-10-04T20:43
at 2009-10-04T20:43

By Necoo
at 2009-10-08T00:34
at 2009-10-08T00:34

By Kelly
at 2009-10-11T07:01
at 2009-10-11T07:01

By Damian
at 2009-10-11T17:26
at 2009-10-11T17:26

By Cara
at 2009-10-14T04:27
at 2009-10-14T04:27

By Rosalind
at 2009-10-14T21:02
at 2009-10-14T21:02

By Kama
at 2009-10-15T08:48
at 2009-10-15T08:48

By Elizabeth
at 2009-10-19T12:06
at 2009-10-19T12:06

By Yedda
at 2009-10-22T05:10
at 2009-10-22T05:10

By Olivia
at 2009-10-24T03:24
at 2009-10-24T03:24

By Liam
at 2009-10-28T02:27
at 2009-10-28T02:27

By Edith
at 2009-10-30T17:37
at 2009-10-30T17:37

By Brianna
at 2009-11-04T03:35
at 2009-11-04T03:35

By Liam
at 2009-11-05T03:43
at 2009-11-05T03:43

By Kumar
at 2009-11-05T17:38
at 2009-11-05T17:38

By Wallis
at 2009-11-08T03:57
at 2009-11-08T03:57

By Skylar DavisLinda
at 2009-11-12T20:25
at 2009-11-12T20:25

By Damian
at 2009-11-16T02:09
at 2009-11-16T02:09

By Edith
at 2009-11-20T14:15
at 2009-11-20T14:15

By Susan
at 2009-11-23T14:37
at 2009-11-23T14:37
Related Posts
vista x64 sp2到底能不能讀ext2?

By Callum
at 2009-07-19T11:49
at 2009-07-19T11:49
一開機就啟動traffic shaping

By Hedy
at 2009-07-19T11:34
at 2009-07-19T11:34
只是一個提案,想要請教可行度

By Mason
at 2009-07-19T09:14
at 2009-07-19T09:14
只是一個提案,想要請教可行度

By Connor
at 2009-07-19T01:06
at 2009-07-19T01:06
土法煉鋼換ubuntu內的firefox

By Lily
at 2009-07-18T22:16
at 2009-07-18T22:16