diff --git a/.obsidian/community-plugins.json b/.obsidian/community-plugins.json index a247921..4cdd5c2 100644 --- a/.obsidian/community-plugins.json +++ b/.obsidian/community-plugins.json @@ -9,5 +9,6 @@ "periodic-notes", "obsidian-git", "obsidian-quiet-outline", - "obsidian-tracker" + "obsidian-tracker", + "hk-code-block" ] \ No newline at end of file diff --git a/05. 資料收集/Linux/fstab.md b/05. 資料收集/Linux/fstab.md new file mode 100644 index 0000000..68dd39e --- /dev/null +++ b/05. 資料收集/Linux/fstab.md @@ -0,0 +1,24 @@ +# 看磁碟UUID +```bash +sudo blkid +``` +```result +/dev/mmcblk0p1: LABEL_FATBOOT="bootfs" LABEL="bootfs" UUID="62C9-51DB" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="bd53c125-01" +/dev/mmcblk0p2: LABEL="rootfs" UUID="2b2cb0b0-aa00-4bd0-b775-4abc1ff31eb2" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="bd53c125-02" +/dev/sda1: UUID="8bd933c6-2625-498f-84cf-0b1394aa3f5e" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Linux filesystem" PARTUUID="6e7fd2d9-1c28-4570-aae2-022f5345781f" +``` + +其中,`UUID="XXXXXXX....."` 這一串就是硬碟的UUID,複製下來,等一下要填到 `fstab` 裡面。 + +# `/etc/fstab` +打開 `/etc/fstab`,加入一行: +```config +UUID=8bd933c6-2625-498f-84cf-0b1394aa3f5e /extusb1/storj ext4 defaults,nofail 0 0 +``` + +- `UUID=8bd933c6-2625-498f-84cf-0b1394aa3f5e`:指定要掛載的磁區是那一個 +- `/extusb1/storj`:指定要掛載的目錄 +- `ext4`: 指定要掛載的格式 +- `defaults,nofail`:檔案格式參數區。`nofail` 是說要是掛載失敗不要產生錯誤訊息,避免因為硬碟壞掉而卡在開機畫面,造成開不了機。尤其是當你的電腦沒有螢幕、鍵盤的時候,會很麻煩。 +- `0`:是否可以被 dump 指令備份 (0:不要做備份﹔1:要做備份﹔2:要做備份,重要度比 1 小)。 +- `0`:是否於開機時以 fsck 檢驗磁區 (0:不檢驗﹔1:先檢驗﹔2:後檢驗)。如果是內接式的硬碟可以改成`0 1`。 diff --git a/05. 資料收集/Linux/硬碟操作.md b/05. 資料收集/Linux/硬碟操作.md new file mode 100644 index 0000000..47abb20 --- /dev/null +++ b/05. 資料收集/Linux/硬碟操作.md @@ -0,0 +1,32 @@ +# 看硬碟代號 +``` +lsblk +``` +```result +NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT +sda 8:0 0 1.8T 0 disk +└─sda1 8:1 0 1.8T 0 part /extusb1/storj +mmcblk0 179:0 0 14.6G 0 disk +├─mmcblk0p1 179:1 0 256M 0 part /boot +└─mmcblk0p2 179:2 0 14.3G 0 part / +``` +衍生出來的`sda1`、`mmcblk0p1`、`mmcblk0p2` 之類的就是硬碟代號 + +# 格式化 +```bash +sudo mkfs.ext4 /dev/sdb123 # sdb123 要換成你自己的硬碟代號 +``` + +# 掛載硬碟 +``` +sudo mount <硬碟代號> <路徑> +``` + +例如: +``` +sudo mount /dev/sda1 /home/user/myusb +``` +就是把`/dev/sda1` 掛載到 `/home/user/myusb` 這個目錄下面。 + +# 開機自動掛載硬碟 +![[fstab]] \ No newline at end of file diff --git a/05. 資料收集/樹莓派/_Map.canvas b/05. 資料收集/樹莓派/_Map.canvas index dd3f095..cefbe78 100644 --- a/05. 資料收集/樹莓派/_Map.canvas +++ b/05. 資料收集/樹莓派/_Map.canvas @@ -1,29 +1,30 @@ { "nodes":[ {"id":"6c6ff5d0e7850ea8","type":"group","x":920,"y":-360,"width":940,"height":1280,"label":"Docker"}, - {"id":"e94c9e71b9aeaa89","type":"group","x":440,"y":-360,"width":400,"height":1100,"label":"基本設定"}, + {"id":"e94c9e71b9aeaa89","type":"group","x":440,"y":-360,"width":400,"height":1280,"label":"基本設定"}, {"id":"368b491f60ea8823","type":"group","x":-720,"y":273,"width":480,"height":647,"label":"工具設定"}, {"id":"acb6cf6a8010bb24","type":"group","x":-720,"y":-360,"width":480,"height":349,"label":"備份設定"}, - {"id":"6e59f6b9f36b24e2","type":"text","text":"![[安裝]]","x":-40,"y":132,"width":383,"height":177}, {"id":"a63a5baed201beda","type":"text","text":"![[設定日誌大小]]","x":460,"y":163,"width":360,"height":180}, - {"id":"bc030994aafc5a3b","type":"text","text":"![[05. 資料收集/樹莓派/bashrc]]","x":460,"y":-37,"width":360,"height":177}, + {"id":"bc030994aafc5a3b","type":"text","text":"# Setup `bashrc`\n![[bashrc#Raspberry Pi]]","x":460,"y":-37,"width":360,"height":177}, {"id":"f210470376a4829d","type":"text","text":"![[設定Cloudflare DDNS]]","x":460,"y":370,"width":360,"height":150}, {"id":"d624199752cf24de","type":"text","text":"![[更新與安裝工具]]","x":460,"y":-340,"width":360,"height":120}, {"id":"6875474760fafe7c","type":"text","text":"![[raspi-config]]","x":460,"y":-200,"width":360,"height":140}, {"id":"ef9431e16c90f57f","type":"text","text":"設定![[smb client]]","x":460,"y":540,"width":360,"height":180}, {"id":"b77234a9cdf72aad","type":"text","text":"# 安裝 docker\n[[Docker#安裝]]","x":940,"y":-340,"width":440,"height":120}, - {"id":"8cac63e48dff1f2a","type":"text","text":"# 安裝 Gitea\n官方教學:[Installation with Docker](https://docs.gitea.com/installation/install-with-docker)\n\n設定Gmail寄信:[Gitea 使用 Gmail 寄信 - 筆記ZONE](https://zonego.tw/2021/11/14/gitea-gmail/)\n","x":940,"y":80,"width":440,"height":140}, - {"id":"94fa9ef036dbe62a","type":"text","text":"# Speedtest 測試\n超簡單命令:`docker run --rm robinmanuelthiel/speedtest:latest`\n\nGithub: [robinmanuelthiel/speedtest: Check internet bandwidth from a Docker container and save the results to an InfluxDB](https://github.com/robinmanuelthiel/speedtest)","x":940,"y":253,"width":440,"height":207}, {"id":"b900ad17a2841b99","type":"text","text":"# 安裝 Filebrowser\n[官方安裝流程](https://filebrowser.org/installation#docker)","x":1400,"y":-340,"width":440,"height":120}, - {"id":"2a7d5efcc0f2dc0e","type":"text","text":"# 安裝 Portainer\n教學: [Portainer:一款圖形化容器管理工具|方格子 vocus](https://vocus.cc/article/643e9f74fd89780001b51739)\n\n官網:[Portainer: Container Management Software for Kubernetes and Docker](https://www.portainer.io/)","x":940,"y":489,"width":440,"height":191}, {"id":"94f3e389e2687b35","type":"text","text":"# 安裝 Watch Tower\n![[Watchtower#或使用 docke-compose.yml|docke-compose.yml]]","x":1400,"y":-190,"width":440,"height":322}, {"id":"d0711febf5985ed5","type":"text","text":"# 安裝nginx-certbot\n教學: [iT 邦幫忙::一起幫忙解決難題,拯救 IT 人的一天](https://ithelp.ithome.com.tw/m/articles/10301801\n\nGithub: [JonasAlfredsson/docker-nginx-certbot: Automatically create and renew website certificates for free using the Let's Encrypt certificate authority.](https://github.com/JonasAlfredsson/docker-nginx-certbot)","x":940,"y":-190,"width":440,"height":240}, + {"id":"6e59f6b9f36b24e2","type":"text","text":"![[安裝]]","x":-40,"y":132,"width":383,"height":177}, + {"id":"8cac63e48dff1f2a","type":"text","text":"# 安裝 Gitea\n官方教學:[Installation with Docker](https://docs.gitea.com/installation/install-with-docker)\n\n設定Gmail寄信:[Gitea 使用 Gmail 寄信 - 筆記ZONE](https://zonego.tw/2021/11/14/gitea-gmail/)\n","x":940,"y":80,"width":440,"height":140}, + {"id":"94fa9ef036dbe62a","type":"text","text":"# Speedtest 測試\n超簡單命令:`docker run --rm robinmanuelthiel/speedtest:latest`\n\nGithub: [robinmanuelthiel/speedtest: Check internet bandwidth from a Docker container and save the results to an InfluxDB](https://github.com/robinmanuelthiel/speedtest)","x":940,"y":253,"width":440,"height":207}, + {"id":"2a7d5efcc0f2dc0e","type":"text","text":"# 安裝 Portainer\n教學: [Portainer:一款圖形化容器管理工具|方格子 vocus](https://vocus.cc/article/643e9f74fd89780001b51739)\n\n官網:[Portainer: Container Management Software for Kubernetes and Docker](https://www.portainer.io/)","x":940,"y":489,"width":440,"height":191}, {"id":"3f1bf9d99d9d544d","type":"text","text":"# 安裝 [Nextcloud](https://nextcloud.com/)\n![[Nextcloud]]","x":1400,"y":489,"width":440,"height":191}, - {"id":"dac28a6e83be787c","type":"text","text":"# 安裝 Grafana\n![[Grafana]]","x":940,"y":720,"width":440,"height":180}, + {"id":"dac28a6e83be787c","type":"text","text":"# 安裝 Grafana\n![[Grafana]]","x":940,"y":700,"width":440,"height":180}, {"id":"fc32cf264646fdec","type":"text","text":"# 安裝 Storj\n![[Storj]]","x":1400,"y":160,"width":440,"height":300}, {"id":"990363c918569555","type":"text","text":"# `~/.vimrc`\n![[vim]]","x":-700,"y":293,"width":440,"height":207}, {"id":"e666f52a66610180","type":"text","text":"# `~/.bashrc`\n![[bashrc#Raspberry Pi]]","x":-700,"y":529,"width":440,"height":371}, - {"id":"ff16e3814718d144","type":"text","text":"# 設定 crontab\n1. 用[[ddns.sh]]定時更新DNS\n2. 用[[backup_docker_gitea.sh]]備份 gitea docker\n3. 用[[backup_pi.sh]]備份整張SD卡","x":-700,"y":-340,"width":440,"height":150} + {"id":"ff16e3814718d144","type":"text","text":"# 設定 crontab\n1. 用[[ddns.sh]]定時更新DNS\n2. 用[[backup_docker_gitea.sh]]備份 gitea docker\n3. 用[[backup_pi.sh]]備份整張SD卡","x":-700,"y":-340,"width":440,"height":150}, + {"id":"8dafa10b92b3f0e4","x":460,"y":740,"width":360,"height":140,"type":"text","text":"# 掛載外接硬碟\n[[硬碟操作]]\n[[fstab]]"} ], "edges":[ {"id":"9683c15c63c167c0","fromNode":"6e59f6b9f36b24e2","fromSide":"right","toNode":"e94c9e71b9aeaa89","toSide":"left"},