1 / 9

fdisk_mkfs.ext4_mount

fdisk_mkfs.ext4_mount. fdisk + 硬碟. 硬碟設備名稱 : / dev / sda s ata d isk a (a 為第一顆 ,b 為第二顆 ….) fdisk -l show 出所有 硬碟 資訊 fdisk -l / dev / sda show 出 第一顆 硬碟資訊 ( 請看 disk size) df -h 查目前用掉多少 disk capacity. 練習新增一 partition & mount 到 /data. fdisk / dev / sda p: print the partition table

keisha
Download Presentation

fdisk_mkfs.ext4_mount

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. fdisk_mkfs.ext4_mount

  2. fdisk+ 硬碟 • 硬碟設備名稱: /dev/sda • sata disk a (a為第一顆,b為第二顆….) • fdisk -l • show出所有硬碟資訊 • fdisk -l /dev/sda • show出第一顆硬碟資訊(請看disk size) • df -h • 查目前用掉多少disk capacity

  3. 練習新增一partition & mount到 /data • fdisk /dev/sda • p: print the partition table • n: 新增partition • First cylinder: 用default值即可,但是還是要注意一下 • Last cylinder: +1000M (就是1G) • 再p一下 • 已新增partition成功 • w (寫入partition table並且離開) • 執行 partprobe或 reboot • partprobe大多無效,請reboot重開

  4. 格式化mkfs.ext4剛剛新增的partition • fdisk -l • 確認一下剛剛新增partition的設備名稱:/dev/sda? • mkfs-t ext4 /dev/sda? • 或 mkfs.ext4 /dev/sda? 亦可

  5. 把新增&格式化好的partition,mount到/data 資料夾 • mkdir /data • 請問 /data 目前在硬碟的那個位置? • cd /data • touch this_file_is_in_root_partitioin_data_folder • mount -t ext4 /dev/sda?/data • 請問 /data 目前在硬碟的那個位置? • 試用/data • cd /data • ls this_file_is_in_root_partitioin_data_folder不見了? • mkdir a b c • touch hello kitty • 想清楚這一頁的紅字

  6. 開機自動將新partition掛載至/data • 若不這麼做,重開後 /dev/sda?又沒掛載了,此時 /data • vim /etc/fstab • 新增一行:/dev/sda? /data ext4 defaults 1 2 • 存檔後重開 • df -h • 看到 /data 成功掛載好了

  7. /etc/fstab編輯錯誤,開不了機?? • 故意把: • /dev/sda? 掛到/data1(無此dir) • /dev/sda9(無此p) 掛到/data2 • 開不了機了

  8. Single user mode • 開機出現文字後按 • 這個再按e • Enter後,再按b即可開機進單人使用模式 • 把/etc/fstab改好後再reboot即可

  9. 哈, 不能編輯 /etc/fstab • mount / -o remount,rw • single user mode 時,預設 / 是 read-only, 動不了 • 一定要重新mount 為 rw (可寫模式)

More Related