Applies to: Proxmox VE nodes using Open-iSCSI, with existing logged-in sessions and systemd.
Before you start
- Check whether your Proxmox version and storage configuration already rescan iSCSI sessions automatically. Use this additional timer only when a separate scheduled scan is required.
- Confirm the required sessions are already connected and healthy. This job rescans existing sessions; target discovery and login configuration remain separate tasks.
- Use a root shell on each node that needs the timer. The files under /etc/systemd/system are local to that node.
- This timer performs an iSCSI session rescan only. Multipath size checks and any LVM growth remain the controlled steps in the shared-LVM expansion guide.
Procedure
1. Check the command path and active sessions
command -v iscsiadm
iscsiadm -m session
systemctl list-timers --allThe service example below uses /usr/bin/iscsiadm. If your command is installed elsewhere, use the path returned above. Review any existing rescan job before adding another one.
2. Create the rescan service
This oneshot service rescans the active sessions. The condition skips a run if there are no iSCSI session entries in sysfs.
cat > /etc/systemd/system/bss-iscsi-rescan.service <<'EOF'
[Unit]
Description=Rescan active iSCSI sessions
Wants=network-online.target
After=network-online.target
ConditionPathExistsGlob=/sys/class/iscsi_session/session*
[Service]
Type=oneshot
User=root
ExecStart=/usr/bin/iscsiadm -m session --rescan
TimeoutStartSec=120
EOF3. Create a five-minute timer
Schedule a run every five minutes, with up to 30 seconds of random delay so nodes do not all scan at exactly the same time.
cat > /etc/systemd/system/bss-iscsi-rescan.timer <<'EOF'
[Unit]
Description=Rescan active iSCSI sessions every five minutes
[Timer]
OnCalendar=*:0/5
RandomizedDelaySec=30s
AccuracySec=1s
Unit=bss-iscsi-rescan.service
[Install]
WantedBy=timers.target
EOF4. Validate the files and test one run
Check for unit errors, reload the definitions and run the service manually. Inspect the journal before enabling the schedule.
systemd-analyze verify /etc/systemd/system/bss-iscsi-rescan.service /etc/systemd/system/bss-iscsi-rescan.timer
systemctl daemon-reload
systemctl start bss-iscsi-rescan.service
journalctl -u bss-iscsi-rescan.service -n 30 --no-pager5. Enable the timer
systemctl enable --now bss-iscsi-rescan.timer
systemctl list-timers --all bss-iscsi-rescan.timerRepeat the setup on the other nodes that require it. To change the interval, edit OnCalendar in the timer, run systemctl daemon-reload, then restart bss-iscsi-rescan.timer.
Check the result
systemctl status bss-iscsi-rescan.timer --no-pager
systemctl show bss-iscsi-rescan.service -p Result -p ExecMainStatus -p ConditionResult
journalctl -u bss-iscsi-rescan.service --since '30 minutes ago' --no-pager- The timer should be active with a next-run time. After a completed run, an inactive oneshot service is normal.
- Check the journal after a scheduled run. A skipped condition means there were no iSCSI session entries when the service was checked; investigate if you expected connected sessions.
- Following a SAN LUN expansion, verify disk-path and multipath sizes before resizing LVM. A successful session rescan alone does not establish that the full expansion is complete.
Disable or remove the timer
Disable the schedule when it is no longer required:
systemctl disable --now bss-iscsi-rescan.timerTo remove the definitions, wait for any running rescan to finish, then remove only the two files created by this guide and reload systemd:
rm -f /etc/systemd/system/bss-iscsi-rescan.timer /etc/systemd/system/bss-iscsi-rescan.service
systemctl daemon-reload