Raspberry Pi 伺服器架設/防火牆建置 === ###### tags: `單板電腦` `Linux` :::success :bookmark: **目錄** :::spoiler [TOC] ::: # 設備 ## 樹梅派 ## 隨身硬碟 :x: 創建軍規1TB隨身硬碟 ## USB_HUB :x: 伽利略 UH007B 7 Port USB_HUB ## SATA USB 外接盒 >[USB 3.0 平躺式堆疊外接硬碟盒](https://blog.xuite.net/bayonetta/LetItGo/54699757-USB+3.0+%E5%B9%B3%E8%BA%BA%E5%BC%8F%E5%A0%86%E7%96%8A%E5%A4%96%E6%8E%A5%E7%A1%AC%E7%A2%9F%E7%9B%92) # 檔案共享 ## 手動/自動掛載USB :one: 下載**pmount**套件 ```shell= sudo apt-get install pmount ``` :two: 確認連接到Rasp的磁碟資訊 ```shell= sudo fdisk-l ``` 資訊欄: - dev/sda1 - Device Boot Start: - 分割表1:/dev/mmcblk0p1 - 分割表2:/dev/mmcblk0p1 :three: 針對USB進行掛載 ```shell= pmount /dev/sda1 [mounted location] ``` ### Command Table | 指令名稱 | 作用 | sudo|備註| |:--------| :-------- |-------- |-------- | | fdisk-l | 查看所有磁碟資訊(裝置檔案) | :o:|| | pmont | 掛載磁碟 | :o:|| | umont | 卸載磁碟 | :o:|| | df -h | 回報所有磁碟使用情形 | :x:|| ### Key document **/etc/fstab** ### BUG:emergency mode >掛載失敗 :point_right: 掛載格式錯誤,應該如下: [裝置檔案] - [掛載點] - [檔案類型] - [組態參數清單] - [傾印旗標] - [開機階段] 裝置檔案:/dev/sda1 掛載點:/media/diskA 檔案類型:vfat 組態參數:透過 mount -a 查詢 傾印旗標:通常為0,待表該磁碟不必被傾印 開機階段:除了根檔案系統,其他磁碟應當在磁碟二進行掛載,所以設定為2 ## 利用**mount**共享Windows資料夾 >須先行理解Win10共享資料夾流程 :star: 自動掛載除了下列步驟外,還得到**raspi-config**進行調整 >[Raspberry PI CIFS mount on boot](https://blog.eq8.eu/til/raspberry-pi-cifs-mount-on-boot.html) 3.Boot Option - B2 Wait for Network at Boot ### Win10 共享資料夾流程 [【教學】區域網路分享-––-共用資料夾](http://ofeyhong.pixnet.net/blog/post/95362789-%E3%80%90%E6%95%99%E5%AD%B8%E3%80%91%E5%8D%80%E5%9F%9F%E7%B6%B2%E8%B7%AF%E5%88%86%E4%BA%AB-%E2%80%93%E2%80%93-%E5%85%B1%E7%94%A8%E8%B3%87%E6%96%99%E5%A4%BE) [linux访问windows共享文件夹的两种方法](https://www.yeboyzq.com/linux/xitongweihu/106.html) [Mounting and AutoMounting Windows Shares on Raspberry Pi](https://rasspberrypi.wordpress.com/2012/09/04/mounting-and-automounting-windows-shares-on-raspberry-pi/) ### 自動掛載共享資料夾 :point_right: 只能夠手動掛載 ```shell= sudo mount -t cifs -o user=pi //L0609-LAPTOP/homeRasp /media/homeRasp ``` ### 測試檔案系統表組態(/etc/fstab) ```shell= sudo miunt -a //全部掛載 ls /media/homeRasp/ //觀察掛載目的地 sudo touch /media/homeRasp/test //新增檔案 sudo rm /media/homeRasp/test //刪除檔案 ``` ### BUG:網路(網路芳鄰)共用資料夾消失 >[Win10 網路芳鄰電腦消失](http://kato3c.pixnet.net/blog/post/463576223-%E8%97%A4%E5%B0%8F%E4%BA%8C%E9%9B%BB%E8%85%A6%E4%BF%AE%E9%85%8D%E5%9D%8A-2018%E5%B9%B4-%E5%85%AC%E5%8F%B8%E5%AE%A2%E6%88%B6%E6%A1%88%E4%BE%8B-%E5%85%AC%E5%8F%B8) >[Win10 變更網路類型設定](http://www.fox-saying.com/blog/post/43766296) >[Win10 區域網路 共享資料夾 設定方法](http://www.fox-saying.com/blog/post/43773565-windows10)  ### BUG:mount error(22) >[第十六章、檔案伺服器之二: SAMBA 伺服器](http://linux.vbird.org/linux_server/0370samba/0370samba-centos5.php) >[How to fix: mount error(22): Invalid argument?](https://raspberrypi.stackexchange.com/questions/15286/how-to-fix-mount-error22-invalid-argument) :point_right: New solution: - raspbian **mount** 访问windows共享文件夹 - raspbian mount windows share file mount error(13) ### :star: BUG:mount error(13) >[CIFS Permission denied error](https://www.raspberrypi.org/forums/viewtopic.php?t=60699) :o: mount :x: samba :point_right: **Scuess** ```shell= sudo mount -t cifs -o user=pi //L0609-LAPTOP/homeRasp /media/homeRasp ``` ### BUG:mount error:could not resolve address >[Raspberry Pi 的實作 - 讓 Linux、Windows、OSX 分享檔案的 File Server ](http://blog.itist.tw/2014/05/samba.html) 出現「mount error: could not resolve address for XXX: Unknown error」錯誤訊息的原因是, mount 指令在連線時是靠 DNS Server 來解析電腦名稱,所以當區域網路裡沒有 DNS Server 的話,就必須直接輸入 IP 位址進行連線才行。 :point_right: 樹梅派DNS配置 ### BUG:開機後無法自動掛載 :point_right: 成功掛載但自動掛載無法生效: ```shell= sudo mount -t cifs -o username='L0609-LAPTOP',password='' //L0609-LAPTOP/homeRasp /media/homeRasp ``` ## 建立檔案伺服器(Samba)
×
Sign in
Email
Password
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