NCNU-OpenSource
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Help
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    1
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    ###### tags: `1111` `lsa` `ncnu` # Week 02 (2022/09/22) [TOC] - Book mode: https://hackmd.io/@ncnu-opensource/book --- ## SSD & HDD - 固態硬碟 SSD(Solid-State Drive): - ![](https://i.imgur.com/h211ypR.png) - 速度快 - 體積小 - 安靜 - 貴 - 每個 sector 有獨立管線 - 每個 sector 為 512 bytes - 沒有磁頭,透過通電去進行讀寫 - 傳統硬碟 HDD(Hard Disk Drive): - ![](https://i.imgur.com/1lWrE1C.png =400x) - ![](https://i.imgur.com/dwNjjVE.png) - 較便宜 - 怕摔到(因為有磁頭) - 斷電的時候磁頭會在旁邊 - 外圈離磁頭最近,若需要頻繁存取須規劃在這邊 - 會規劃 boot 開機磁區, swap 置換磁區 - sector 圍成一個圈組成 track,track 組成 Cylinder > 硬碟的開頭是內圈還是外圈?外圈吧 - 開機磁區 - 主分割區 ### swap分割區 > 在實體記憶體( RAM )用完時,才會使用到,假如系統需要更多記憶體資源,而實體記憶體空間不足,會將記憶體上不活動的頁面移到SWAP空間 [color=#af220c] > 建議大小為記憶體之兩倍大空間 [color=#9F0050] - 作法: 1. 把不需要的資源先移去別處,讓出空間 2. 把資源炸掉 boom - [百科知識: Swap 分區80](https://baike.baidu.hk/item/Swap%E5%88%86%E5%8D%80/7613378) - 查看磁碟分割區: - Linux 1. 九個點 ![](https://i.imgur.com/tRRYfpq.png =50x) 2. Disk ![](https://i.imgur.com/wlD7ook.png =50x) 3. 磁碟分割狀況 ![](https://i.imgur.com/Cg9e11s.png) - windows - Windows +R 輸入Diskmgmt.msc - 直接對window按右鍵,可以看到磁碟管理 ## File System - 使用檔案和樹狀目錄的抽象邏輯概念代替硬碟、光碟等物理裝置使用資料塊的概念 - Windows: NTFS - 將檔案分成小片段,根據使用狀況重新排列,往後取用的時候磁頭會跳來跳去 - Linux: 常用 Ext 系列檔案系統 - https://opensource.com/article/18/4/ext4-filesystem - 不會有檔案分散存取,導致讀取檔案時磁頭需到處亂跳的特性 - Inode: - 在許多「類Unix檔案系統」中的一種特殊的資料結構,在磁碟會成立體樹狀排列。 ![](https://i.imgur.com/0Vma03C.png) ### Ext3 - 日誌功能: 在硬碟中規畫出一個區塊,專門用於記錄資料寫入與修改的動作,如果在硬碟寫入的過程發生問題,可以藉由日誌的紀錄加速硬碟的修復,有三種級別 - Journal: - 這提高了安全性,但損失效能,因為所有資料要寫入兩次 - 發生資料崩潰,那麼可能有兩種情況: 1. 日誌完整: 這時事務會被重新執行 2. 日誌不完整:因為這時主檔案系統還未被修改,只需要簡單放棄這個事務 - Ordered: - 預設選項 - 資料還未寫入時發生崩潰的話,恢復時這個實務會被簡單的復原,檔案保持原來的狀態 - Writeback: - 在內容寫入磁碟之前,紀錄 Metadata - 資料還未寫入完成就發生錯誤,那麼檔案系統恢復後,檔案後面就可能出現垃圾資料 - 最大可支援到 32 TB,單一檔案最大可支援 2 TB, 單一目錄最多可以存放 32,000 個子目錄 ### Ext4 - 可關閉日誌功能:檔案損毀可接受,但效能要最佳化。 - 磁碟容量最大可以支援到 1 EB(1 EB=1024PB, 1 PB=1024TB),單一檔案最大可以支援到 16 TB,單一目錄最多可以存放 64,000 個子目錄。 - 允許對一檔案預先保留磁碟空間。目前大多數檔案系統作到這點的方式就是直接產生一個填滿0的空間。 - fallocate - 提高檔案下次寫入的速度 ### SWAP - 使用情況: 實體記憶體快被用完的時候, - 延伸的記憶體空間 - swap可以幫助系統增加一部分空間(RAM),但不能將它當作更多記憶體的替代品。 - 存取速度比實體記憶體慢 >謝謝各位 :::spoiler 其他超強的 FS - [Btrfs](https://zh.wikipedia.org/zh-tw/Btrfs) > 作者把太太殺掉就去坐牢了。:astonished: - [為什麼 QNAP 不使用 Btrfs 檔案系統](https://www.qnap.com/solution/qnap-ext4/zh-tw/) - ["無聲資料損毀"難防 Btrfs檔案系統來保護](https://www.netadmin.com.tw/netadmin/zh-tw/technology/BFF6D67A985545F78A1FB8F2A12BE9ED?page=1) - [ZFS](https://zh.wikipedia.org/zh-tw/ZFS) - [ZFS檔案系統儲存應用7大優勢](https://www.ithome.com.tw/tech/90412) ::: ## Linux 簡介 - 作者:Linus Torvalds - Linux Foundation - 類 UNIX 系統 UNIX-like - 從 UNIX 延伸出來的系統 - **在 Linux 裡面所有東西皆為檔案** ### Ubuntu - Ubuntu 是主流 Linux 發行版之一,也是目前桌面環境市占率最大的。 > 簡單易用,阿嬤用得都比你溜。:sunglasses: - 有三種版本: - **桌面版(圖形化介面 GUI)** :需要較大的記憶體 - 包含一些需要的軟體 - ![](https://i.imgur.com/0L3Afey.png) - **伺服器版(黑體白字)**:需要的記憶體容量較小,但比較不容易上手 - 只有 terminal 介面 - ![](https://i.imgur.com/KTAyQV6.png) - **core版** - 針對物聯網、機器人之使用 - Linux系統比較重視權限管理,因此也較不容易中毒 - Windows 系統中毒的時候,可以透過『try Ubuntu』來進行病毒的排除。 :::warning **下週的作業內容** - 找出自己有興趣的部份 - 上網找相關的指令(用於Terminal) ::: ## terminal 指令 > 遵循 KISS 原則: Keep It Simple and Stupid > 按上即可直接使用上一行輸入的指令 - `tab`: 自動補齊指令 - `double tab`: 列出所有相關字元指令 - `fdisk -lu`: 可以看見**Permission denied(權限不足)** > 原因: 因為目前我們的身分為 一般使用者 - `sudo` : super user do,超級使用者權限 > 第一次需要輸入密碼 > 沒事不要亂用(root也是) - `man fdisk`: fdisk 的指令操作手冊 - man: manual 操作手冊,可以看見各種指令怎麼操作 - 搜尋功能:`/` + 欲搜尋之指令 - `-l` ![](https://i.imgur.com/MWI5NMa.png) - 參數 + `-h` 或 `--help`: 可已知道參數的使用方法和指令規則 >基本上幾乎所有指令都有支援 - 前面指令+ `|` + 後面指令: - 把前一個指令 轉去 給另一個指令處理 > 例: `sudo fdisk -l| less` >> 把 `sudo fdisk -l` 之結果轉交給 `less` 做處理 - 可以直接搜尋某一顆硬碟的資訊 ![](https://i.imgur.com/8Wi5wKs.png) - `sudo fdisk -l ` ![](https://i.imgur.com/WWNxgtE.png) - `ls /dev/`: 列出所有硬碟資訊 - ![](https://i.imgur.com/g5VmFeR.png)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully