Closed9

Raspberry PI 4 で UGREEN NASync iSCSI 自動マウント

ピン留めされたアイテム
Futa HirakobaFuta Hirakoba

UGREEN の NASync が届いたので、自宅に一台余ってる Raspberry PI 4 で 1 からネットワークブートする。
残り二つの稼働中のラズパイは順次移行していく予定。まずは実験も兼ねてまっさらな状態でやってみる。

ネットワークブートのモチベ

  • Micro SD カードのみで運用する
    • 知らんうちに Micro SD カードが死ぬ。データも消える
  • 外付け HDD をつなぐ
    • 知らんうちに死ぬのがだいぶ遠のく。実際今ある 2 つのラズパイではやってる
    • でも場所を取る。コンセントも要る。ヘルスチェックもだるい
  • そこで NAS 上のハードディスクをメインのストレージにする

という感じでネットワークブート(ハイブリッド)を目指していたが、さっぱりうまくいかなかったため、/home, /opt, /var/log, /var/lib, /tmp のみを自動でマウントするようにした。

TFTP サーバを立てて完全にネットワークブートする方法ならいけたかもだけど、現状市販ルーターで DHCP を行ってるので自前で DHCP サーバを用意するのは面倒だったので今回は試さなかった。

Futa HirakobaFuta Hirakoba

最終的な今回の構成を実現するための手順書を AI に書かせた。

Raspberry Pi 4 + Ugreen NASync iSCSIハイブリッドブート設定手順書

Raspberry Pi 4 + Ugreen NASync iSCSIハイブリッドブート設定手順書

概要

SDカード障害リスクを軽減するため、重要なデータをiSCSIディスクに移行する構成です。

構成

  • SDカード: /boot/firmware + 基本システム(/
  • iSCSIディスク: /home, /opt, /var/log, /var/lib, /tmp

必要な環境

  • Raspberry Pi 4
  • Ugreen NASync DXP2800(iSCSI対応NAS)
  • 有線LAN接続

事前準備

1. NAS側でのiSCSI設定

  1. LUN作成

    • 容量: 32GB以上推奨
    • ファイルシステム: ext4
  2. Targetの作成

    • 例: iqn.2025-03.com.ugreen:target-1.89a95c5b8d
  3. CHAP認証設定

    • ユーザー名・パスワードを設定
  4. Groupの作成

    • Initiator IQN: iqn.1993-08.org.debian:01:rpi4-[シリアル番号]

2. Raspberry Pi基本セットアップ

# システム更新
sudo apt update && sudo apt full-upgrade -y

# 必要パッケージインストール
sudo apt install open-iscsi -y

# CPUシリアル番号確認(Initiator名に使用)
cat /proc/cpuinfo | grep Serial

Step 1: Initiator設定

1.1 Initiator名の設定

# Initiator名を編集
sudo nano /etc/iscsi/initiatorname.iscsi

内容を以下に変更(シリアル番号は各Piで異なります):

InitiatorName=iqn.1993-08.org.debian:01:rpi4-[CPUシリアル番号の末尾8文字]

1.2 CHAP認証設定

# iSCSI設定ファイル編集
sudo nano /etc/iscsi/iscsid.conf

以下の行を見つけてコメントアウトを外し、値を設定:

node.session.auth.authmethod = CHAP
node.session.auth.username = [NASで設定したCHAPユーザー名]
node.session.auth.password = [NASで設定したCHAPパスワード]
node.startup = automatic
node.leading_login = Yes

1.3 iSCSIサービス開始

# サービス有効化・開始
sudo systemctl enable iscsid
sudo systemctl start iscsid

# ターゲット検出・接続
sudo iscsiadm -m discovery -t st -p [NASのIPアドレス]:3260
sudo iscsiadm -m node -T [Target IQN] -p [NASのIPアドレス]:3260 --login

# 接続確認
sudo iscsiadm -m session
lsblk

Step 2: iSCSIディスクの準備

2.1 パーティション作成

# パーティションテーブル作成
sudo fdisk /dev/sda

fdisk操作:

g     # GPTパーティションテーブル作成
n     # 新しいパーティション
1     # パーティション番号1
Enter # 開始セクタ(デフォルト)
Enter # 終了セクタ(全領域使用)
w     # 書き込み

2.2 ファイルシステム作成

# ext4ファイルシステム作成
sudo mkfs.ext4 /dev/sda1

# 確認
lsblk -f

2.3 システムデータのコピー

# マウントポイント作成
sudo mkdir /mnt/iscsi-root

# iSCSIディスクをマウント
sudo mount /dev/sda1 /mnt/iscsi-root

# システム全体をコピー
sudo rsync -avx \
  --exclude=/proc \
  --exclude=/sys \
  --exclude=/dev \
  --exclude=/run \
  --exclude=/tmp \
  --exclude=/mnt \
  --exclude=/media \
  --exclude=/lost+found \
  / /mnt/iscsi-root/

# 必要なディレクトリ作成
sudo mkdir -p /mnt/iscsi-root/{proc,sys,dev,run,tmp,mnt,media}

# アンマウント
sudo umount /mnt/iscsi-root

Step 3: 自動接続サービス作成

3.1 systemdサービス作成

# サービスファイル作成
sudo nano /etc/systemd/system/iscsi-autoconnect.service

内容:

[Unit]
Description=iSCSI Auto Connect
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/iscsiadm -m discovery -t st -p [NASのIPアドレス]:3260
ExecStart=/usr/bin/iscsiadm -m node -T [Target IQN] -p [NASのIPアドレス]:3260 --login
ExecStop=/usr/bin/iscsiadm -m node -T [Target IQN] -p [NASのIPアドレス]:3260 --logout

[Install]
WantedBy=multi-user.target

3.2 サービス有効化

# サービス有効化
sudo systemctl enable iscsi-autoconnect.service
sudo systemctl daemon-reload

Step 4: 段階的ディレクトリ移行

4.1 fstab設定

# fstabに以下を追加
sudo nano /etc/fstab

追加内容:

# iSCSI storage
/dev/sda1  /mnt/iscsi-storage  ext4  defaults,noatime,_netdev  0  2
/mnt/iscsi-storage/home  /home  none  bind  0  0
/mnt/iscsi-storage/opt  /opt  none  bind  0  0
/mnt/iscsi-storage/var/log  /var/log  none  bind  0  0
/mnt/iscsi-storage/var/lib  /var/lib  none  bind  0  0
/mnt/iscsi-storage/tmp  /tmp  none  bind  0  0

4.2 マウント適用

# systemd設定更新
sudo systemctl daemon-reload

# マウント適用
sudo mount -a

# /tmpの権限修正
sudo chmod 1777 /tmp

4.3 動作確認

# マウント状況確認
mount | grep /dev/sda1

# ディスク使用量確認
df -h

# 各ディレクトリの動作テスト
echo "test" > ~/test.txt && rm ~/test.txt
echo "test" > /tmp/test.txt && rm /tmp/test.txt

Step 5: 最終テスト

5.1 再起動テスト

sudo reboot

5.2 起動後確認

# iSCSI接続確認
sudo iscsiadm -m session

# マウント状況確認
mount | grep /dev/sda1

# サービス状況確認
sudo systemctl status iscsi-autoconnect.service

# ディスク使用量確認
df -h

トラブルシューティング

起動しない場合

  1. SDカードで復旧

    # fstabのiSCSI関連行をコメントアウト
    sudo nano /etc/fstab
    
  2. サービス無効化

    sudo systemctl disable iscsi-autoconnect.service
    

iSCSI接続が切れる場合

# 手動再接続
sudo iscsiadm -m discovery -t st -p [NASのIPアドレス]:3260
sudo iscsiadm -m node -T [Target IQN] -p [NASのIPアドレス]:3260 --login

ログ確認

# システムログ
sudo journalctl -xe

# iSCSIログ
dmesg | grep -i iscsi

環境別設定値

各Raspberry Piで変更が必要な項目

  1. Initiator IQN: CPUシリアル番号で生成
  2. NAS側Group設定: 新しいInitiator IQNを追加
  3. systemdサービスファイル: NASのIPアドレスとTarget IQNを確認

NAS側で追加作業

  1. 新しいLUN作成(Pi毎に個別)
  2. Groupに新しいInitiator追加
  3. LUNマッピング設定

最終構成

成功した場合の構成:

  • SDカード: /boot/firmware + /(基本システム)
  • iSCSIディスク: /home, /opt, /var/log, /var/lib, /tmp

この構成により、SDカード障害リスクを大幅に軽減しつつ、高い安全性と拡張性を確保できます。

Futa HirakobaFuta Hirakoba

LUN、Target の作成

  1. UGOS で SAN Manager をインストール
  2. LUN を作成
    • 名前: LUN-1
    • 説明: Raspberry-3
    • 種類: Thick LUN
    • 位置: ボリューム1
    • 容量: 32 GB
  3. Target を作成
    • 名前: Target-1_raspberry-3
    • CHAP 認証: true
    • IQN: iqn.2025-03.com.ugreen:target-1.xxxxxxxx
Futa HirakobaFuta Hirakoba

RaspberryPI OS のインスコ&アプデ

余ってる MicroSD カードに Raspberry Pi Imager を使って OS を焼く。
Raspberry PI OS Lite (64-bit) にした。ssh 情報も設定済み。

起動してちょっと待ってると arp で IP アドレスが出てきたので ssh。

パッケージ更新
sudo apt update && sudo apt full-upgrade -y

途中なんか聞かれて止まってた。よくわからんけどメンテナバージョンでいいっしょ!

Configuration file '/etc/initramfs-tools/initramfs.conf'
 ==> Modified (by you or by a script) since installation.
 ==> Package distributor has shipped an updated version.
   What would you like to do about it ?  Your options are:
    Y or I  : install the package maintainer's version
    N or O  : keep your currently-installed version
      D     : show the differences between the versions
      Z     : start a shell to examine the situation
 The default action is to keep your current version.
*** initramfs.conf (Y/I/N/O/D/Z) [default=N] ? Y
Installing new version of config file /etc/initramfs-tools/initramfs.conf ...
必要なパッケージのインスコ
sudo apt install open-iscsi rpi-eeprom -y
EEP-ROMの更新
pi@raspberrypi-3:~ $ sudo rpi-eeprom-update -a
*** PREPARING EEPROM UPDATES ***

BOOTLOADER: update available
   CURRENT: Thu 16 Apr 17:11:26 UTC 2020 (1587057086)
    LATEST: Thu  8 May 15:21:35 UTC 2025 (1746717695)
   RELEASE: default (/usr/lib/firmware/raspberrypi/bootloader-2711/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
   VL805: update available
   CURRENT: 000137ad
    LATEST: 000138c0
   CURRENT: Thu 16 Apr 17:11:26 UTC 2020 (1587057086)
    UPDATE: Thu  8 May 15:21:35 UTC 2025 (1746717695)
    BOOTFS: /boot/firmware
'/tmp/tmp.bBV3EkoEVf' -> '/boot/firmware/pieeprom.upd'
Copying recovery.bin to /boot/firmware for EEPROM update

EEPROM updates pending. Please reboot to apply the update.
To cancel a pending update run "sudo rpi-eeprom-update -r".

再起動しろとのこと。sudo reboot

バージョン確認
pi@raspberrypi-3:~ $ sudo rpi-eeprom-update
BOOTLOADER: up to date
   CURRENT: Thu  8 May 15:21:35 UTC 2025 (1746717695)
    LATEST: Thu  8 May 15:21:35 UTC 2025 (1746717695)
   RELEASE: default (/usr/lib/firmware/raspberrypi/bootloader-2711/default)
            Use raspi-config to change the release.

  VL805_FW: Dedicated VL805 EEPROM
     VL805: up to date
   CURRENT: 000138c0
    LATEST: 000138c0

CURRENT: Thu 8 May 15:21:35 UTC 2025 (1746717695) となってるのでヨシ!

Futa HirakobaFuta Hirakoba

iSCSI 設定

InitiatorName を NAS の方で許可するために Group を作成。

  • Group名: Raspberries
  • イニシエーターIQN:
    • iqn.1993-08.org.debian:01:xxxxxxxx

/etc/iscsi/iscsid.conf を編集。

  • node.session.auth.authmethod: CHAP
  • node.session.auth.username: <設定したユーザー名>
  • node.session.auth.password: <設定したパスワード>
  • node.startup: automatic
  • node.leading_login: Yes

接続チェック&マウント。

pi@raspberrypi-3:~ $ sudo systemctl enable iscsid
Synchronizing state of iscsid.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable iscsid
Created symlink /etc/systemd/system/sysinit.target.wants/iscsid.service → /lib/systemd/system/iscsid.service.
pi@raspberrypi-3:~ $ sudo systemctl start iscsid
pi@raspberrypi-3:~ $ sudo iscsiadm -m discovery -t st -p <NASのIPアドレス>:3260
<NASのIPアドレス>:3260,1 iqn.2025-03.com.ugreen:target-1.xxxxxxxx
pi@raspberrypi-3:~ $ sudo iscsiadm -m node -T iqn.2025-03.com.ugreen:target-1.xxxxxxxx -p <NASのIPアドレス>:3260 --login
Logging in to [iface: default, target: iqn.2025-03.com.ugreen:target-1.xxxxxxxx, portal: <NASのIPアドレス>,3260]
Login to [iface: default, target: iqn.2025-03.com.ugreen:target-1.xxxxxxxx, portal: <NASのIPアドレス>,3260] successful.
pi@raspberrypi-3:~ $ sudo iscsiadm -m session
tcp: [1] <NASのIPアドレス>:3260,1 iqn.2025-03.com.ugreen:target-1.xxxxxxxx (non-flash)
pi@raspberrypi-3:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINTS
sda           8:0    0   32G  0 disk
mmcblk0     179:0    0 29.8G  0 disk
├─mmcblk0p1 179:1    0  512M  0 part /boot/firmware
└─mmcblk0p2 179:2    0 29.3G  0 part /

sda の 32 G が NAS で作った LUN っぽい。接続はうまくいってそう。

Futa HirakobaFuta Hirakoba

OS のコピー

パーティションを作成。

pi@raspberrypi-3:~ $ sudo fdisk /dev/sda

Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS (MBR) disklabel with disk identifier 0xcb46c926.

Command (m for help): g
Created a new GPT disklabel (GUID: A94FFFF9-4911-984E-8FBA-E85F3546EDA2).

Command (m for help): n
Partition number (1-128, default 1): 1
First sector (16384-67108830, default 16384):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (16384-67108830, default 67092479):

Created a new partition 1 of type 'Linux filesystem' and of size 32 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

ファイルシステムを作成。

pi@raspberrypi-3:~ $ sudo mkfs.ext4 /dev/sda1
mke2fs 1.47.0 (5-Feb-2023)
Discarding device blocks: done
Creating filesystem with 8384512 4k blocks and 2097152 inodes
Filesystem UUID: d4f473d0-fc98-4b3f-907f-25ed4b05744b
Superblock backups stored on blocks:
	32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
	4096000, 7962624

Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

pi@raspberrypi-3:~ $ lsblk -f
NAME        FSTYPE FSVER LABEL  UUID                                 FSAVAIL FSUSE% MOUNTPOINTS
sda
└─sda1      ext4   1.0          d4f473d0-fc98-4b3f-907f-25ed4b05744b
mmcblk0
├─mmcblk0p1 vfat   FAT32 bootfs EC36-4DE1                               444M    13% /boot/firmware
└─mmcblk0p2 ext4   1.0   rootfs d4cc7d63-da78-48ad-9bdd-64ffbba449a8   24.9G     8% /

OS をコピー

sudo mkdir /mnt/iscsi-root
sudo mount /dev/sda1 /mnt/iscsi-root
sudo rsync -avx --exclude=/proc --exclude=/sys --exclude=/dev --exclude=/run --exclude=/tmp --exclude=/mnt / /mnt/iscsi-root/
sudo mkdir -p /mnt/iscsi-root/{proc,sys,dev/pts,run,tmp}
Futa HirakobaFuta Hirakoba

iSCSI 側に chroot

fstab の修正。

/mnt/iscsi-root/etc/fstab
/dev/sda1  /              ext4    defaults,noatime  0  1
/dev/sda1  /boot/firmware  none    bind              0  0
proc       /proc          proc    defaults          0  0
sysfs      /sys           sysfs   defaults          0  0
devpts     /dev/pts       devpts  defaults          0  0
tmpfs      /tmp           tmpfs   defaults          0  0
pi@raspberrypi-3:~ $ sudo mount -t proc proc /mnt/iscsi-root/proc
pi@raspberrypi-3:~ $ sudo mount -t sysfs sysfs /mnt/iscsi-root/sys
pi@raspberrypi-3:~ $ sudo mount -o bind /dev /mnt/iscsi-root/dev
pi@raspberrypi-3:~ $ sudo mount -o bind /dev/pts /mnt/iscsi-root/dev/pts
pi@raspberrypi-3:~ $ mount | grep /mnt/iscsi-root
/dev/sda1 on /mnt/iscsi-root type ext4 (rw,relatime,stripe=2048)
proc on /mnt/iscsi-root/proc type proc (rw,relatime)
sysfs on /mnt/iscsi-root/sys type sysfs (rw,relatime)
udev on /mnt/iscsi-root/dev type devtmpfs (rw,nosuid,relatime,size=1673248k,nr_inodes=418312,mode=755)
devpts on /mnt/iscsi-root/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
pi@raspberrypi-3:~ $ sudo chroot /mnt/iscsi-root
root@raspberrypi-3:/#
root@raspberrypi-3:/# pwd
/
root@raspberrypi-3:/# ls /
bin  boot  dev	etc  home  lib	lost+found  media  opt	proc  root  run  sbin  srv  sys  tmp  usr  var
root@raspberrypi-3:/# cat /etc/hostname
raspberrypi-3

無事使えてそう。

Futa HirakobaFuta Hirakoba

デフォルトをネットワークブートにする(これさっぱりうまくいかなかった)

initramfs設定を修正

root@raspberrypi-3:/# echo 'MODULES=netboot' >> /etc/initramfs-tools/initramfs.conf
root@raspberrypi-3:/# echo 'iscsi_tcp' >> /etc/initramfs-tools/modules
root@raspberrypi-3:/# echo 'libiscsi' >> /etc/initramfs-tools/modules
root@raspberrypi-3:/# echo 'scsi_transport_iscsi' >> /etc/initramfs-tools/modules

ネットワーク設定の追加

root@raspberrypi-3:/# echo 'DEVICE=eth0' >> /etc/initramfs-tools/initramfs.conf
root@raspberrypi-3:/# echo 'BOOT=nfs' >> /etc/initramfs-tools/initramfs.conf

iSCSI接続情報の設定

root@raspberrypi-3:/# echo 'ISCSI_INITIATOR=iqn.1993-08.org.debian:01:rpi4-xxxxxxxx' >> /etc/initramfs-tools/initramfs.conf
echo 'ISCSI_TARGET_NAME=iqn.2025-03.com.ugreen:target-1.xxxxxxxx' >> /etc/initramfs-tools/initramfs.conf
echo 'ISCSI_TARGET_IP=<NASのIPアドレス>' >> /etc/initramfs-tools/initramfs.conf
echo 'ISCSI_TARGET_PORT=3260' >> /etc/initramfs-tools/initramfs.conf
echo 'ISCSI_USERNAME=<ユーザー名>' >> /etc/initramfs-tools/initramfs.conf
echo 'ISCSI_PASSWORD=<パスワード>' >> /etc/initramfs-tools/initramfs.conf
root@raspberrypi-3:/# update-initramfs -u -k $(uname -r)
update-initramfs: Generating /boot/initrd.img-6.12.34+rpt-rpi-v8
'/boot/initrd.img-6.12.34+rpt-rpi-v8' -> '/boot/firmware/initramfs8'
root@raspberrypi-3:/# systemctl enable iscsid
Synchronizing state of iscsid.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable iscsid
root@raspberrypi-3:/# systemctl enable open-iscsi
Synchronizing state of open-iscsi.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable open-iscsi
pi@raspberrypi-3:~ $ sudo rpi-eeprom-config --edit
Updating bootloader EEPROM
 image: /usr/lib/firmware/raspberrypi/bootloader-2711/default/pieeprom-2025-05-08.bin
config_src: blconfig device
config: /tmp/tmpfi7pqy5y/boot.conf
################################################################################
BOOT_UART=0
WAKE_ON_GPIO=1
POWER_OFF_ON_HALT=0

BOOT_ORDER=0x21
TFTP_PREFIX=0
DHCP_TIMEOUT=45000
DHCP_REQ_TIMEOUT=4000

################################################################################
*** CREATED UPDATE /tmp/tmpfi7pqy5y/pieeprom.upd  ***

   CURRENT: Thu  8 May 15:21:35 UTC 2025 (1746717695)
    UPDATE: Thu  8 May 15:21:35 UTC 2025 (1746717695)
    BOOTFS: /boot/firmware
'/tmp/tmp.jFGylOOOK2' -> '/boot/firmware/pieeprom.upd'
Copying recovery.bin to /boot/firmware for EEPROM update

EEPROM updates pending. Please reboot to apply the update.
To cancel a pending update run "sudo rpi-eeprom-update -r".

再起動したら、LUN への接続はうまくいくが 53 番ポートしか開けず ssh できず。。。
この後色々色々試したがさっぱりうまくいかなかった。

Futa HirakobaFuta Hirakoba

boot は SD カードで行って頻繁に使われるディレクトリを NAS で使うようにする

systemd を使って自動で接続するようにする。

/etc/systemd/system/iscsi-autoconnect.service
[Unit]
Description=iSCSI Auto Connect
After=network-online.target
Wants=network-online.target

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/iscsiadm -m discovery -t st -p [NASのIPアドレス]:3260
ExecStart=/usr/bin/iscsiadm -m node -T [Target IQN] -p [NASのIPアドレス]:3260 --login
ExecStop=/usr/bin/iscsiadm -m node -T [Target IQN] -p [NASのIPアドレス]:3260 --logout

[Install]
WantedBy=multi-user.target
sudo systemctl enable iscsi-autoconnect.service
sudo systemctl daemon-reload

fstab で特定のディレクトリをマウントするように設定。

/etc/fstab
# iSCSI storage
/dev/sda1  /mnt/iscsi-storage  ext4  defaults,noatime,_netdev  0  2
/mnt/iscsi-storage/home  /home  none  bind  0  0
/mnt/iscsi-storage/opt  /opt  none  bind  0  0
/mnt/iscsi-storage/var/log  /var/log  none  bind  0  0
/mnt/iscsi-storage/var/lib  /var/lib  none  bind  0  0
/mnt/iscsi-storage/tmp  /tmp  none  bind  0  0
sudo systemctl daemon-reload

動作確認

pi@raspberrypi-3:~ $ mount | grep /dev/sda1
/dev/sda1 on /mnt/iscsi-storage type ext4 (rw,noatime,stripe=2048,_netdev)
/dev/sda1 on /home type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /opt type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /tmp type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /var/lib type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /var/log type ext4 (rw,noatime,stripe=2048)

sudo reboot で再起動。

pi@raspberrypi-3:~ $ mount | grep /dev/sda1
/dev/sda1 on /mnt/iscsi-storage type ext4 (rw,noatime,stripe=2048,_netdev)
/dev/sda1 on /home type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /opt type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /tmp type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /var/lib type ext4 (rw,noatime,stripe=2048)
/dev/sda1 on /var/log type ext4 (rw,noatime,stripe=2048)
pi@raspberrypi-3:~ $ sudo systemctl status iscsi-autoconnect.service
● iscsi-autoconnect.service - iSCSI Auto Connect
     Loaded: loaded (/etc/systemd/system/iscsi-autoconnect.service; enabled; preset: enabled)
     Active: active (exited) since Sat 2025-08-16 17:11:01 JST; 12min ago
    Process: 470 ExecStart=/usr/bin/iscsiadm -m discovery -t st -p <NASのIPアドレス>:3260 (code=exited, status=0/SU>
    Process: 532 ExecStart=/usr/bin/iscsiadm -m node -T iqn.2025-03.com.ugreen:target-1.xxxxxxxx -p 192.168.>
   Main PID: 532 (code=exited, status=0/SUCCESS)
        CPU: 42ms

Aug 16 17:10:56 raspberrypi-3 systemd[1]: Starting iscsi-autoconnect.service - iSCSI Auto Connect...
Aug 16 17:10:56 raspberrypi-3 iscsiadm[470]: iscsiadm: cannot make connection to <NASのIPアドレス>: Network is unre>
Aug 16 17:10:57 raspberrypi-3 iscsiadm[470]: iscsiadm: cannot make connection to <NASのIPアドレス>: Network is unre>
Aug 16 17:10:58 raspberrypi-3 iscsiadm[470]: iscsiadm: cannot make connection to <NASのIPアドレス>: Network is unre>
Aug 16 17:10:59 raspberrypi-3 iscsiadm[470]: iscsiadm: cannot make connection to <NASのIPアドレス>: Network is unre>
Aug 16 17:11:00 raspberrypi-3 iscsiadm[470]: iscsiadm: cannot make connection to <NASのIPアドレス>: Network is unre>
Aug 16 17:11:01 raspberrypi-3 iscsiadm[470]: <NASのIPアドレス>:3260,1 iqn.2025-03.com.ugreen:target-1.xxxxxxxx
Aug 16 17:11:01 raspberrypi-3 iscsiadm[532]: Logging in to [iface: default, target: iqn.2025-03.com.ugreen:tar>
Aug 16 17:11:01 raspberrypi-3 iscsiadm[532]: Login to [iface: default, target: iqn.2025-03.com.ugreen:target-1>
Aug 16 17:11:01 raspberrypi-3 systemd[1]: Finished iscsi-autoconnect.service - iSCSI Auto Connect.

再起動してもマウントされたまま。
当初の目的と大きくかけ離れてしまったけどよしとするか...

このスクラップは28日前にクローズされました