From 1cd8f61a13f3134675fef9a30751425d450c6a06 Mon Sep 17 00:00:00 2001 From: "Kaz Saita(WSL2)" Date: Sun, 4 Feb 2024 21:50:01 +0900 Subject: [PATCH] commit(auto) --- ...0204184839 raspi4 家サーバー 作業ログ 1.md | 244 +++++++++--------- 1 file changed, 127 insertions(+), 117 deletions(-) diff --git a/content/20240204184839 raspi4 家サーバー 作業ログ 1.md b/content/20240204184839 raspi4 家サーバー 作業ログ 1.md index 2ff93da..33353e7 100755 --- a/content/20240204184839 raspi4 家サーバー 作業ログ 1.md +++ b/content/20240204184839 raspi4 家サーバー 作業ログ 1.md @@ -28,12 +28,139 @@ で保存ボタンを押す。 `Would you like to apply OS customization settings?` で、 「はい」を選んで書き込み。 +完全に同じことを、USBのSSDで実施する。 +microSDはブートの設定を変更する目的で作っている。設定変更後には使用しない。 + ### ルーターの設定 - DHCPスタティックIP設定 を追加 ### 起動 書きこんだらRaspi 4に挿して、LANケーブルなど繋いで起動。 wsl2上のubuntuから、sshで接続確認。 +ここまでできたら、SSD bootの設定をする。 + +### SSD bootに設定 +色々と情報を見たが、一番簡単で確実な方法は、 +- microSDでブート、bootloaderを最新にする +- SSDを + +SSDをUSBで接続。認識されると、こんな感じになる。 + +``` +$ dmesg +[ 2371.382886] sd 0:0:0:0: [sda] Attached SCSI disk +[ 2555.521771] usb 2-2: USB disconnect, device number 3 +[ 2555.565777] sd 0:0:0:0: [sda] Synchronizing SCSI cache +[ 2555.801704] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x07 driverbyte=DRIVER_OK +[ 2627.619831] usb 2-2: new SuperSpeed USB device number 4 using xhci_hcd +[ 2627.652398] usb 2-2: New USB device found, idVendor=0bda, idProduct=9210, bcdDevice=f0.01 +[ 2627.652420] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 +[ 2627.652433] usb 2-2: Product: RTL9210 +[ 2627.652442] usb 2-2: Manufacturer: Realtek +[ 2627.652451] usb 2-2: SerialNumber: 012345678905 +[ 2627.684644] usb 2-2: Enable of device-initiated U1 failed. +[ 2627.685583] usb 2-2: Enable of device-initiated U2 failed. +[ 2627.714973] usb 2-2: Enable of device-initiated U1 failed. +[ 2627.716024] usb 2-2: Enable of device-initiated U2 failed. +[ 2627.720692] scsi host0: uas +[ 2628.284123] scsi 0:0:0:0: Direct-Access Realtek RTL9210 NVME 1.00 PQ: 0 ANSI: 6 +[ 2628.302746] sd 0:0:0:0: Attached scsi generic sg0 type 0 +[ 2628.306857] sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB) +[ 2628.308244] sd 0:0:0:0: [sda] Write Protect is off +[ 2628.308260] sd 0:0:0:0: [sda] Mode Sense: 37 00 00 08 +[ 2628.310966] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA +[ 2628.312278] sd 0:0:0:0: [sda] Preferred minimum I/O size 512 bytes +[ 2628.312300] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes +[ 2628.324088] sda: sda1 sda2 +[ 2628.324372] sd 0:0:0:0: [sda] Attached SCSI disk +[ 2753.358307] sda: sda1 sda2 +``` + +fdiskで全部のパーティーションを削除。状況によって異なるので割愛。 +bootloaderのバージョン確認 +``` +$ vcgencmd bootloader_version +2023/01/11 17:40:52 +version 8ba17717fbcedd4c3b6d4bce7e50c7af4155cba9 (release) +timestamp 1673458852 +update-time 0 +capabilities 0x0000007f +``` + +`sudo raspi-config` + +A7 Boot ROM Versionを最新に。 +`E1 Latest Use the latest version boot ROM software` を選択して再起動。 + +``` +$ vcgencmd bootloader_version +2024/01/22 10:41:21 +version 51ed67b03b3dde4e76b345370f312d07aabf45b8 (release) +timestamp 1705920081 +update-time 1707048097 +capabilities 0x0000007f +``` + +``` +$ sudo apt install git +``` + +``` +$ git clone https://github.com/billw2/rpi-clone.git +$ cd rpi-clone +$ sudo cp rpi-clone rpi-clone-setup /usr/local/sbin +``` + +``` +sudo rpi-clone-setup -t saipi4(ホストネームなので各自で変更してください) +``` + +``` +$ sudo fdisk -l +``` +で、USB接続したSSDがどこに接続せされているかを確認。自分の場合 /dev/sda +``` +Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors +Disk model: RTL9210 NVME +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 33553920 bytes +Disklabel type: gpt +Disk identifier: C678576F-F4F8-417E-9A1E-032A60DF551C + +Device Start End Sectors Size Type +/dev/sda1 534528 567295 32768 16M Microsoft reserved +/dev/sda2 567296 500115455 499548160 238.2G Microsoft basic data +``` + +``` +$ sudo ./rpi-clone sda -f +``` +あとは適当にyesとかを選択しつつ、最後までやる。 コピーされると、こんな感じになる。 + +``` +$ sudo fdisk -l + +Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors +Disk model: RTL9210 NVME +Units: sectors of 1 * 512 = 512 bytes +Sector size (logical/physical): 512 bytes / 512 bytes +I/O size (minimum/optimal): 512 bytes / 33553920 bytes +Disklabel type: dos +Disk identifier: 0x37e8fc91 + +Device Boot Start End Sectors Size Id Type +/dev/sda1 8192 1056767 1048576 512M c W95 FAT32 (LBA) +/dev/sda2 1056768 500118191 499061424 238G 83 Linux +``` + +ここまでできたら、USBブートにする + +cf. +- [ラズパイ4をUSB接続のSSDから起動する方法(USBブート) | ラズパイダ](https://raspida.com/rpi4-ssd-usb-boot) +- [Raspberry PiのバックアップをCLIから作成する | Vogelbarsch](https://vogelbarsch.com/2020-08-27-140104/) +- [Rasberry Piでrpi-cloneを使ってバックアップ | TomoSoft](https://tomosoft.jp/design/?p=8721) + ### sshを公開鍵認証にする 以下はwsl2のubuntuでやる。 @@ -132,120 +259,3 @@ $ sudo apt full-upgrade $ sudo reboot (最新にしたので再起動) ``` ` -### SSD bootに設定 - -SSDをUSBで接続。認識されると、こんな感じになる。 - -``` -$ dmesg -[ 2371.382886] sd 0:0:0:0: [sda] Attached SCSI disk -[ 2555.521771] usb 2-2: USB disconnect, device number 3 -[ 2555.565777] sd 0:0:0:0: [sda] Synchronizing SCSI cache -[ 2555.801704] sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x07 driverbyte=DRIVER_OK -[ 2627.619831] usb 2-2: new SuperSpeed USB device number 4 using xhci_hcd -[ 2627.652398] usb 2-2: New USB device found, idVendor=0bda, idProduct=9210, bcdDevice=f0.01 -[ 2627.652420] usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3 -[ 2627.652433] usb 2-2: Product: RTL9210 -[ 2627.652442] usb 2-2: Manufacturer: Realtek -[ 2627.652451] usb 2-2: SerialNumber: 012345678905 -[ 2627.684644] usb 2-2: Enable of device-initiated U1 failed. -[ 2627.685583] usb 2-2: Enable of device-initiated U2 failed. -[ 2627.714973] usb 2-2: Enable of device-initiated U1 failed. -[ 2627.716024] usb 2-2: Enable of device-initiated U2 failed. -[ 2627.720692] scsi host0: uas -[ 2628.284123] scsi 0:0:0:0: Direct-Access Realtek RTL9210 NVME 1.00 PQ: 0 ANSI: 6 -[ 2628.302746] sd 0:0:0:0: Attached scsi generic sg0 type 0 -[ 2628.306857] sd 0:0:0:0: [sda] 500118192 512-byte logical blocks: (256 GB/238 GiB) -[ 2628.308244] sd 0:0:0:0: [sda] Write Protect is off -[ 2628.308260] sd 0:0:0:0: [sda] Mode Sense: 37 00 00 08 -[ 2628.310966] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA -[ 2628.312278] sd 0:0:0:0: [sda] Preferred minimum I/O size 512 bytes -[ 2628.312300] sd 0:0:0:0: [sda] Optimal transfer size 33553920 bytes -[ 2628.324088] sda: sda1 sda2 -[ 2628.324372] sd 0:0:0:0: [sda] Attached SCSI disk -[ 2753.358307] sda: sda1 sda2 -``` - -fdiskで全部のパーティーションを削除。状況によって異なるので割愛。 -bootloaderのバージョン確認 -``` -$ vcgencmd bootloader_version -2023/01/11 17:40:52 -version 8ba17717fbcedd4c3b6d4bce7e50c7af4155cba9 (release) -timestamp 1673458852 -update-time 0 -capabilities 0x0000007f -``` - -`sudo raspi-config` -A7 Boot ROM Versionを最新に。 -`E1 Latest Use the latest version boot ROM software` を選択して再起動。 - -``` -$ vcgencmd bootloader_version -2024/01/22 10:41:21 -version 51ed67b03b3dde4e76b345370f312d07aabf45b8 (release) -timestamp 1705920081 -update-time 1707048097 -capabilities 0x0000007f -``` - -``` -$ sudo apt install git -``` - -``` -$ git clone https://github.com/billw2/rpi-clone.git -$ cd rpi-clone -$ sudo cp rpi-clone rpi-clone-setup /usr/local/sbin -``` - -``` -sudo rpi-clone-setup -t saipi4(ホストネームなので各自で変更してください) -``` - -``` -$ sudo fdisk -l -``` -で、USB接続したSSDがどこに接続せされているかを確認。自分の場合 /dev/sda -``` -Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors -Disk model: RTL9210 NVME -Units: sectors of 1 * 512 = 512 bytes -Sector size (logical/physical): 512 bytes / 512 bytes -I/O size (minimum/optimal): 512 bytes / 33553920 bytes -Disklabel type: gpt -Disk identifier: C678576F-F4F8-417E-9A1E-032A60DF551C - -Device Start End Sectors Size Type -/dev/sda1 534528 567295 32768 16M Microsoft reserved -/dev/sda2 567296 500115455 499548160 238.2G Microsoft basic data -``` - -``` -$ sudo ./rpi-clone sda -f -``` -あとは適当にyesとかを選択しつつ、最後までやる。 コピーされると、こんな感じになる。 - -``` -$ sudo fdisk -l - -Disk /dev/sda: 238.47 GiB, 256060514304 bytes, 500118192 sectors -Disk model: RTL9210 NVME -Units: sectors of 1 * 512 = 512 bytes -Sector size (logical/physical): 512 bytes / 512 bytes -I/O size (minimum/optimal): 512 bytes / 33553920 bytes -Disklabel type: dos -Disk identifier: 0x37e8fc91 - -Device Boot Start End Sectors Size Id Type -/dev/sda1 8192 1056767 1048576 512M c W95 FAT32 (LBA) -/dev/sda2 1056768 500118191 499061424 238G 83 Linux -``` - -ここまでできたら、USBブートにする - -cf. -- [ラズパイ4をUSB接続のSSDから起動する方法(USBブート) | ラズパイダ](https://raspida.com/rpi4-ssd-usb-boot) -- [Raspberry PiのバックアップをCLIから作成する | Vogelbarsch](https://vogelbarsch.com/2020-08-27-140104/) -- [Rasberry Piでrpi-cloneを使ってバックアップ | TomoSoft](https://tomosoft.jp/design/?p=8721)