Dhcp.leases in persistent partition

Hi all, I’ve read[¹] that the new nethsecurity 8.8 implement the dhcp.leases in a persistent partition in a way that dns know leases even after a reboot. In the bug report I can read what happens to dhcp.leases when a persistent partition is added or removed but no mention about when a nethsecurity with persistent partition is upgraded to 8.8… and that’s my case :wink:

Well that’s what happens:

root@nethsecurity:~# cat /etc/os-release
NAME=“NethSecurity”
VERSION=“8.8.0”
ID=“nethsecurity”
ID_LIKE=“lede openwrt”
PRETTY_NAME=“NethSecurity 8.8.0”
VERSION_ID=“8.8.0”
HOME_URL=" GitHub - NethServer/nethsecurity: NethSecurity image and build environment · GitHub "
BUG_URL=" Issues · NethServer/nethsecurity · GitHub "
SUPPORT_URL=“https://community.nethserver.org
FIRMWARE_URL=“https://downloads.openwrt.org/
BUILD_ID=“r33051-f5dae5ece4”
OPENWRT_BOARD=“x86/64”
OPENWRT_ARCH=“x86_64”
OPENWRT_TAINTS=“no-all busybox”
OPENWRT_DEVICE_MANUFACTURER=“Nethesis”
OPENWRT_DEVICE_MANUFACTURER_URL=“https://www.nethesis.it
OPENWRT_DEVICE_PRODUCT=“NethSecurity”
OPENWRT_DEVICE_REVISION=“v0”
OPENWRT_RELEASE=“NethSecurity 8.8.0 v25.12.5”
OPENWRT_BUILD_DATE=“1782737960”
root@nethsecurity:~# uci get dhcp.ns_dnsmasq.leasefile
/tmp/dhcp.leases
root@nethsecurity:~# mount | grep /mnt/data
/dev/sdb1 on /mnt/data type ext4 (rw,relatime)

Now how can I move the dhcp.leases to /mnt/data?
I have to make it manually in a way like this one?

PERSISTENT_FOLDER=/mnt/data
DHCP_FOLDER=$PERSISTENT_FOLDER
mkdir $DHCP_FOLDER
/etc/init.d/dnsmasq stop
[ -f  "$(uci get dhcp.ns_dnsmasq.leasefile)" ] && cp $(uci get dhcp.ns_dnsmasq.leasefile) $DHCP_FOLDER && uci set dhcp.ns_dnsmasq.leasefile="$DHCP_FOLDER/dhcp.leases" && uci commit dhcp
/etc/init.d/dnsmasq start

Do you suggest other ways?

[¹] Preserve dnsmasq DHCP leases on mounted storage · Issue #1694 · NethServer/nethsecurity · GitHub

Run /usr/libexec/ns-storage-dhcp-leases

it works, thank you:

root@nethsecurity:~# /usr/libexec/ns-storage-dhcp-leases
root@nethsecurity:~# uci get dhcp.ns_dnsmasq.leasefile
/mnt/data/dnsmasq/dhcp.leases

Have a great day!

Paolo