Skip to content

joni97k/MovePveStorageCFG_onShutdown

Repository files navigation

This Service moves your /etc/pve/storage.cfg before shutdown to a backup file additionaly you can load another storage.cfg backup file on boot. if needed.

use case:

if you have a storage.cfg file that has iscsi connections but you have no fencing or locking and you run multiple nodes but not in a cluster you can ensure that the node never connects on boot to iscsi LUN which would result in data corruption.

deployment

/usr/local/bin/
├── mvStorageCFG.sh           # Save storage config before shutdown
├── loadOnBootStorageCFG.sh   # Load safe config on boot

/etc/systemd/system/
├── mv-storagecfg.service              # Runs on shutdown
├── load-storagecfg-onboot.service     # Runs on boot
chmod +x /usr/local/bin/*.sh

Enable the services

systemctl daemon-reexec
systemctl daemon-reload

systemctl enable mv-storagecfg.service
systemctl enable load-storagecfg-onboot.service

# test the services
# Manually test the shutdown backup service
systemctl start mv-storagecfg.service

# Manually test the boot-time restore service
systemctl start load-storagecfg-onboot.service

# Check that the backup file was created
ls -l /etc/pve/StorageCFGbeforeShutdown.myconf

# Check that the current storage.cfg matches your on-boot config
diff /etc/pve/storage.cfg /etc/pve/onBootStorageCFG

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages