1 / 28

第 10 章 磁碟與檔案系統管理

第 10 章 磁碟與檔案系統管理. 內容 主機與周邊設備 磁碟與作業系統 磁碟機構造 磁碟機分割 檔案系統架構 磁碟與檔案系統工具 檔案系統掛載 重要的目錄及檔案. 10-1 主機與周邊設備 (1). 電腦系統的硬體結構 主機板、主機介面 ( 如 PCI 、 USB 介面 ) 、 周邊連線 ( 如 Centronics) 、 IO 擴充卡 ( 如 磁碟控制卡 ) IO 介面 ( 如 IDE 、 SCSI). 10-1 主機與周邊設備 (2). 磁碟控制系統. 10-1 主機與周邊設備 (3). 磁碟的裝置檔案配置.

Download Presentation

第 10 章 磁碟與檔案系統管理

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 第 10章 磁碟與檔案系統管理 內容 • 主機與周邊設備 • 磁碟與作業系統 • 磁碟機構造 • 磁碟機分割 • 檔案系統架構 • 磁碟與檔案系統工具 • 檔案系統掛載 • 重要的目錄及檔案

  2. 10-1主機與周邊設備 (1) • 電腦系統的硬體結構 • 主機板、主機介面 (如 PCI 、USB 介面)、 • 周邊連線 (如 Centronics)、IO 擴充卡 (如 磁碟控制卡) • IO 介面 (如 IDE 、SCSI)

  3. 10-1主機與周邊設備 (2) • 磁碟控制系統

  4. 10-1主機與周邊設備 (3) • 磁碟的裝置檔案配置

  5. 10-2磁碟與作業系統 (1) • 磁碟作業系統 (Disk Operating System, DOS) • 作業系統安裝於磁碟機內。 • 磁碟機隨時導入系統程式、執行參數也隨時暫存於磁碟機。 • 磁碟啟動程序 • DOS 系統的硬體設施

  6. 10-2磁碟與作業系統 (2) • DOS 系統啟動程序

  7. 10-2磁碟與作業系統 (3) • 磁碟與檔案系統存取 – 磁碟檔案系統 • 實體儲存與邏輯存取之間的映像 • 裝置檔案(Device file) • 區塊驅動(Block driver) • 字元驅動(Character driver) • 檔案系統(File system) • 系統呼叫(System call)

  8. 10-3磁碟機構造 (1) • 軟碟機構造 • 同心圓雙面朔膠片,上面塗有磁粉,利用極化效果儲存資料。 • 5.25 吋磁片 • 磁面:A, B • 磁軌:80 • 磁區:30 • 磁區容量:512 Byte • 磁片容量:512 * 30 * 80 *2 = 1.2 Mbyte • 磁區為讀寫單位。

  9. 10-3 磁碟機構造 (2) • 硬碟機構造 • 多面磁片堆疊而成。 • 所有磁片連結成同心軸,同時轉動。 • 所有磁頭連結成一磁臂,同時進出讀取/寫入資料。 • 一次可以大量寫入/讀取多個磁區。

  10. 10-3磁碟機構造 (3) • 磁柱: • 每面磁片劃分多個同心圓 (磁軌) • 所有磁片上同一個磁軌,稱為 “磁柱”。 • 硬碟容量 = 磁柱數 * 磁頭 * 磁區 * 磁區容量

  11. 10-4磁碟機分割 (1) • 將一個實體磁碟機分割成多個邏輯磁碟機,每個邏輯磁碟機可獨立使用(如格式化、安裝系統、備份 、、)。 • 分割方法 • 以磁柱為分割單位(/dev/hda) • /dev/hda0:磁柱 0 ~ k-1 • /dev/hda1:磁柱 k ~ n-1 • /dev/hda2:磁柱 n ~ m-1

  12. 10-4磁碟機分割 (2) • 分割原因 (1) • 資料備份

  13. 10-4磁碟機分割 (3) • 分割原因(2) • 多重開機

  14. 10-4磁碟機分割 (4) • 分割原因 (3) • 磁區大小

  15. 10-4磁碟機分割 (5) • Unix/Linux 系統分割區種類 • 每個分割區有某一特殊功能。 • 如 Fedora core • /boot:系統啟動程式 • / :系統主目錄空間 • /var :系統狀態與應用程式設定檔 • /usr :除作業系統外,所安裝的應用程式 • /home :使用者家目錄 • Swap :交換區 • 其他應用,如 database, ….。

  16. 10-5檔案系統結構 (1) • 格式化後分割區結構

  17. 10-5檔案系統結構 (2) • 超級區塊 • 紀錄分割區重要訊息 • $ df [tsnien@Secure-1 ~]$ df -i 檔案系統 Inode I已用 I可用 I已用% 掛載點 /dev/hdb6 130560 8489 122071 7% / /dev/hdb1 130560 32 130528 1% /boot tmpfs 32013 1 32012 1% /dev/shm /dev/hdb3 767232 15654 751578 3% /home /dev/hdb8 130560 11 130549 1% /opt /dev/hdb7 130560 23 130537 1% /tmp /dev/hdb2 12812288 185427 12626861 2% /usr /dev/hdb9 130560 2748 127812 3% /var

  18. 10-5檔案系統結構 (3) • 資料區塊 • 一個檔案可放於多個區塊上 • 一個區塊僅可被一個檔案存放 • 磁區大小影響有效使用率 • 觀察磁區數量與使用狀態 • $ df [tsnien@Secure-1 ~]$ df 檔案系統 1K-區段 已用 可用 已用% 掛載點 /dev/hdb6 505604 234601 244899 49% / /dev/hdb1 505604 13988 465512 3% /boot tmpfs 128052 0 128052 0% /dev/shm /dev/hdb3 2972268 833608 1985240 30% /home /dev/hdb8 505604 10545 468955 3% /opt /dev/hdb7 505604 10553 468947 3% /tmp /dev/hdb2 49594228 4457284 42576988 10% /usr /dev/hdb9 505604 107922 371578 23% /var

  19. 10-5檔案系統結構 (4) • Inode 區塊 • 紀錄檔案資訊 • $ df -i

  20. 10-5檔案系統結構 (5) • 觀察 檔案的 inode 編號 • 觀察 inode table 所紀錄訊息 [tsnien@Secure-1 ~]$ ls -i 418033 1 418140 mail1.txt 418347 add_user 415701 Man_user 418116 alice 417995 Man_user.txt 418746 AudFilt.dll 418807 mbox 418126 Bob 415881 openssl 418755 book 418756 picture 418754 build_file 418753 read_1 [tsnien@Secure-1 ~]$ ls -l 總計 64944 -rw-rw-r-- 1 tsnien tsnien 2 4月 26 2008 1 -rwxr--r-- 1 tsnien tsnien 385 5月 11 2009 add_user drwxrwxr-x 3 tsnien tsnien 4096 7月 31 2008 alice -rw-r--r-- 1 tsnien tsnien 172032 6月 9 2009 AudFilt.dll drwxrwxr-x 2 tsnien tsnien 4096 7月 31 2008 Bob drwxrwxr-x 3 tsnien tsnien 4096 10月 2 2009 book

  21. 10-5檔案系統結構 (6) • 檔案連結型態(1) • 硬連結型態

  22. 10-5檔案系統結構 (6) • 檔案連結型態(2) • 符號連結型態

  23. 10-6磁碟與檔案管理工具 • 管理命令: (請依照書本範例操作練習) • 分割磁碟機 – fdisk • 硬碟參數管理 – hdparm • 建立檔案系統 – mkfs • 檢查檔案系統 – fsck • 檔案系統使用狀態 – df • 檔案佔用空間 - du

  24. 10-7檔案系統掛載 (1) • 階層式架構

  25. 10-7檔案系統掛載 (2) • 掛載位置 – /etc/fstab • 掛載紀錄 - /etc/mtab [tsnien@Secure-1 ~]$ cat /etc/fstab LABEL=/ / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 devpts /dev/pts devpts gid=5,mode=620 0 0 tmpfs /dev/shm tmpfs defaults 0 0 LABEL=/home /home ext3 defaults 1 2 LABEL=/opt /opt ext3 defaults 1 2 [tsnien@Secure-1 ~]$ cat /etc/mtab /dev/hdb6 / ext3 rw 0 0 /dev/hdb1 /boot ext3 rw 0 0 tmpfs /dev/shm tmpfs rw 0 0 /dev/hdb3 /home ext3 rw 0 0 /dev/hdb8 /opt ext3 rw 0 0 /dev/hdb7 /tmp ext3 rw 0 0 /dev/hdb2 /usr ext3 rw 0 0 /dev/hdb9 /var ext3 rw 0 0

  26. 10-7檔案系統掛載 (3) • 掛載管理 (請參考書本操作) • 掛載命令 – mount • 卸載命令 - umount

  27. 10-8 重要的目錄與檔案 • 主系統目錄 • /etc • /bin • /lib • …. • 較重要的檔案及目錄 • /etc/passwd • /etc/shadow • ……

  28. 10-9 檔案系統維護的程式設計 • 請依照書本範例輸入練習 • 10-9-1 查詢檔案系統的使用狀態 – ex10_1 • 10-9-2搜尋使用率較高的檔案系統 – ex10_2 • 10-9-3搜尋佔用大空間之目錄 – ex10_3 • 10-9-4搜尋佔用大空間之檔案 – ex10_4

More Related