Yu-Hao(Howard) Hsu
    • Create new note
    • Create a note from template
      • 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
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me 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 New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy 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
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me 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
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # [simplefs](https://github.com/jserv/simplefs) 學習紀錄與疑惑 ### 測試環境 Ubuntu ~~19.10~~ -> ubuntu 18.04.4 LTS kernel version: ~~5.3.0-29-generic~~ -> 4.9.102 ## Build and Test 結果 ``` $ ls mount/ $ cat mount/vanakkam ``` 以上兩個指令需要 sudo 權限。 ``` $ echo "Hello World" > mount/hello ``` 以上指令失敗,權限不足。 ``` $ cat mount/hello ``` 推測無法創建 hello 這個 file,自然透過 cat 也無法印出任何東西。 ### 執行 simple-test.sh 得到以下錯誤: ```bash simple-test.sh: line 18: /sys/module/jbd2/parameters/jbd2_debug: No such file or directory ``` > 根據 https://cateee.net/lkddb/web-lkddb/JBD2_DEBUG.html 看起來應該是沒打開 `CONFIG_JBD2_DEBUG`,有待驗證。 透過 `$ cat /boot/config-5.3.0-29-generic | grep CONFIG_JBD2_DEBUG` 確認,確實沒打開。 ![](https://i.imgur.com/vVmgkBe.png) 如果要打開這個 config,只能夠重新編 linux kernel 了。 ## 打開 CONFIG_JBD2_DEBUG 1. 第一步必須重新編譯 linux kernel 2. 根據 [ubuntu-wiki](https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel)來重新編譯 kernel ``` $ apt-get source linux-image-$(uname -r) $ cd linux-signed-5.3.0/ $ chmod a+x debian/rules ``` 3. 途中遇到問題 ``` haogroot@haogroot-TP:~/linux-signed-5.3.0$ fakeroot debian/rules editconfigs dh editconfigs dh: Unknown sequence editconfigs (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep) make: *** [debian/rules:37: editconfigs] Error 255 ``` google 到看來有許多人照著這個 wiki 都碰到類似問題... 4. 根據這篇[教學](https://www.cyberciti.biz/tips/compiling-linux-kernel-26.html),升級 kernel 到 stable version 5.4.17,並打開 `JBD2 (ext4) debugging support` > 更新完後開機,卡在紫色畫面... google 有看到一些討論,有可能是硬體 bios 的問題或是 intel microcode 的問題,再看到 ubuntu 目前官方最新支援到 5.3.0.29,先暫時放棄升級到 5.4.17,之後應該會選擇低於 5.3.0.29 的版本 5. customize linux kernel 參考[此篇](https://www.howtogeek.com/howto/ubuntu/how-to-customize-your-ubuntu-kernel/),以原本的 kernel version 來重新編譯 ```bash= root@haogroot-TP:/usr/src/linux# fakeroot make-kpkg --initrd --append-to-version=-custom kernel_image kernel_headers ``` 編譯失敗,因為硬碟空間不足... 6. 決定直接虛擬機開下去就好... 參考[這篇](https://medium.com/@vishhvak/compiling-a-custom-linux-kernel-on-a-virtual-machine-12be9d32189b)成功打開該 config。 環境為: Ubuntu 18.04.4 LTS Kernel 4.9.102 ## 再次 build and test Intall linux headers 失敗,但我透過 `$ sudo apt-get install linux-headers-generic` 安裝,顯示安裝了 linux-headers-4.15.0-76-generic 執行 `$ echo "Hello World" > mount/hello` > 權限不足 給予 /mount 權限後 (`chmod 777 mount`),再度執行`$ echo "Hello World" > mount/hello`,顯示以下錯誤。 ``` bash: echo: write error: Read-only file system ``` 可以成功建立檔案,但無法寫入。 `$ ls -lR` ![](https://i.imgur.com/MZJe9Vx.png) ### 執行 simple-test.sh * 要有 root 權限 * ## 觀察 simple-test.sh ```shell=bash set -x // 執行指令後會顯示所有指令 [ -d "$test_mount_point" ] // test_mount_point 是不是 directory ``` ```clike= dd bs=4096 count=100 if=/dev/zero of="$1" ./mkfs-simplefs "$1" ``` * `/dev/zero`: when you read this special file, it will provies you null character * Create a 409600 Bytes file, called $1. The first 100 bytes contains null character. ## loop device loop device is a `pseudo-device` that makes a file accessible as a block device.

    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