Truenas spins up disk every 1 and 1/2 hours

Just recently my disk started spinning up every one and a half hours. I don’t really know what changed since I haven’t updated Truenas in a while. Is there a way to find out what is causing it? Any logs I could access? I don’t see anything in a traffic capture on my firewall that suggest access through SMB or something.

My disk don’t need to spin all the time since I rarely access them. Any help is appreciated.

Are you still on TrueNAS Core 13, like your sig says?

Sorry not up to date. I am on Goldeye Truenas Scale. I was using Fangtooth when it started though. but the update did not fix the issue.

I updated the signature. Truenas runs as a VM in Proxmox but hardware is fully passed through.

It changed around that time. This is a recent discussion with links in it that may help.

But I was usually sitting next to my server and even under Fangtooth the issue started recently. And I never noticed the disks spinning up before. The only thing I changed recently is that I setup snapshots but only twice a month. So this can’t be the issue either. I might revert back to Fangtooth and see but that issue does not seem to be related.

Ok so it is every 90mins for sure. Maybe related after all. Very annoying.

I am using SAS SSDs/HDDs environment in TrueNAS Scale 26.
The 90min Spin-Up Problem bothered me for quite a long time.

Today I started a test (helped by AI), and the following “smartctl_wrap in tmpfs” method which I applied as “Init/Shutdown Scripts” worked fine for SAS HDDs.

** use AI generated script with yourown risk. :rofl:

mkdir -p /run/smartctl_wrap
mountpoint -q /run/smartctl_wrap || mount -t tmpfs -o size=8m,mode=755,exec tmpfs /run/smartctl_wrap
[ -f /run/smartctl_wrap/smartctl.real ] || cp /usr/sbin/smartctl /run/smartctl_wrap/smartctl.real

cat << 'EOF' > /run/smartctl_wrap/smartctl
#!/bin/bash
for arg in "$@"; do
    if [[ -b "$arg" ]]; then
        sdparm --readonly --command=sense "$arg" 2>/dev/null | grep -qi "standby" && exit 2
        break
    fi
done
exec /run/smartctl_wrap/smartctl.real "$@"
EOF

chmod 755 /run/smartctl_wrap/smartctl
mountpoint -q /usr/sbin/smartctl || mount --bind /run/smartctl_wrap/smartctl /usr/sbin/smartctl

AI also suggested the following script for mixed SAS/SATA system, but I don’t have SATA HDDs therefore can’t confirm that…

** once again, use AI generated script with yourown risk. :rofl:

This script automatically detects the drive interface via /sys/block/sdX/device/sas_address, routing SAS drives to sdparm and SATA drives to native hdparm -C (audited for syntax and idempotency):

mkdir -p /run/smartctl_wrap
mountpoint -q /run/smartctl_wrap || mount -t tmpfs -o size=8m,mode=755,exec tmpfs /run/smartctl_wrap
[ -f /run/smartctl_wrap/smartctl.real ] || cp /usr/sbin/smartctl /run/smartctl_wrap/smartctl.real

cat << 'EOF' > /run/smartctl_wrap/smartctl
#!/bin/bash
for arg in "$@"; do
    if [[ -b "$arg" ]]; then
        dev_name=$(basename "$arg")
        if [[ -e "/sys/block/${dev_name}/device/sas_address" ]]; then
            sdparm --readonly --command=sense "$arg" 2>/dev/null | grep -qi "standby" && exit 2
        else
            hdparm -C "$arg" 2>/dev/null | grep -qiE "standby|sleeping" && exit 2
        fi
        break
    fi
done
exec /run/smartctl_wrap/smartctl.real "$@"
EOF

chmod 755 /run/smartctl_wrap/smartctl
mountpoint -q /usr/sbin/smartctl || mount --bind /run/smartctl_wrap/smartctl /usr/sbin/smartctl