What is best method to use scroll lock to show hdd activity?

My Mini pc does not show HDD activity…I looked at hard drive widgets but couldn’t find any that just gave a simple blinking light for r/w. I searched and found various methods to use the scroll lock, caps lock etc for hdd lights but apparently they are outdated as none of the ones I found worked. Thanks!

System:
  Kernel: 6.12.0-rc6-1-mainline-x64v3 arch: x86_64 bits: 64 compiler: gcc v: 14.2.1
    clocksource: tsc avail: acpi_pm parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-mainline-x64v3
    root=UUID=5ad7fecd-1a14-4590-8ce1-42685c5ee6c8 rw rootflags=subvol=@ quiet
    rd.luks.uuid=2bdec0d6-999c-4a5a-9278-70a5c8e236d9 loglevel=3 ibt=off
  Desktop: KDE Plasma v: 6.2.2 tk: Qt v: N/A info: frameworks v: 6.7.0 wm: kwin_wayland
    with: krunner vt: 1 dm: SDDM Distro: Garuda base: Arch Linux
Machine:
  Type: Desktop Mobo: N/A model: N/A serial: <superuser required> uuid: <superuser required>
    UEFI: American Megatrends LLC. v: AM08Pro_P5C5V19 date: 09/20/2023
Battery:
  Device-1: hidpp_battery_2 model: Logitech M570 serial: <filter> charge: 95% rechargeable: yes
    status: discharging
CPU:
  Info: model: AMD Ryzen 7 7735HS with Radeon Graphics bits: 64 type: MT MCP arch: Zen 3+ gen: 3
    level: v3 note: check built: 2022 process: TSMC n6 (7nm) family: 0x19 (25) model-id: 0x44 (68)
    stepping: 1 microcode: 0xA404102
  Topology: cpus: 1x dies: 1 clusters: 1 cores: 8 threads: 16 tpc: 2 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB L3: 16 MiB desc: 1x16 MiB
  Speed (MHz): avg: 4018 min/max: 400/4829 boost: enabled scaling: driver: amd-pstate-epp
    governor: powersave cores: 1: 4018 2: 4018 3: 4018 4: 4018 5: 4018 6: 4018 7: 4018 8: 4018
    9: 4018 10: 4018 11: 4018 12: 4018 13: 4018 14: 4018 15: 4018 16: 4018 bogomips: 102267
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities: <filter>
Graphics:
  Device-1: Advanced Micro Devices [AMD/ATI] Rembrandt [Radeon 680M] driver: amdgpu v: kernel
    arch: RDNA-2 code: Navi-2x process: TSMC n7 (7nm) built: 2020-22 pcie: gen: 4 speed: 16 GT/s
    lanes: 16 ports: active: HDMI-A-1 empty: DP-1, DP-2, DP-3, DP-4, DP-5, HDMI-A-2, Writeback-1
    bus-ID: e5:00.0 chip-ID: 1002:1681 class-ID: 0300 temp: 64.0 C
  Device-2: Sunplus Innovation Full HD webcam driver: snd-usb-audio,uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-1.1.4.2:13 chip-ID: 1bcf:2284 class-ID: 0102
    serial: <filter>
  Display: wayland server: X.org v: 1.21.1.14 with: Xwayland v: 24.1.4 compositor: kwin_wayland
    driver: X: loaded: amdgpu unloaded: modesetting alternate: fbdev,vesa dri: radeonsi gpu: amdgpu
    display-ID: 0
  Monitor-1: HDMI-A-1 res: 2752x1152 size: N/A modes: N/A
  API: EGL v: 1.5 hw: drv: amd radeonsi platforms: device: 0 drv: radeonsi device: 1 drv: swrast
    gbm: drv: kms_swrast surfaceless: drv: radeonsi wayland: drv: radeonsi x11: drv: radeonsi
  API: OpenGL v: 4.6 compat-v: 4.5 vendor: amd mesa v: 24.2.6-arch1.1 glx-v: 1.4
    direct-render: yes renderer: AMD Radeon 680M (radeonsi rembrandt LLVM 18.1.8 DRM 3.59
    6.12.0-rc6-1-mainline-x64v3) device-ID: 1002:1681 memory: 3.91 GiB unified: no display-ID: :1.0
  API: Vulkan v: 1.3.295 layers: 3 device: 0 type: integrated-gpu name: AMD Radeon 680M (RADV
    REMBRANDT) driver: mesa radv v: 24.2.6-arch1.1 device-ID: 1002:1681 surfaces: xcb,xlib,wayland
    device: 1 type: cpu name: llvmpipe (LLVM 18.1.8 256 bits) driver: mesa llvmpipe
    v: 24.2.6-arch1.1 (LLVM 18.1.8) device-ID: 10005:0000 surfaces: xcb,xlib,wayland
Audio:
  Device-1: Advanced Micro Devices [AMD/ATI] Rembrandt Radeon High Definition Audio
    driver: snd_hda_intel v: kernel pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: e5:00.1
    chip-ID: 1002:1640 class-ID: 0403
  Device-2: Advanced Micro Devices [AMD] ACP/ACP3X/ACP6x Audio Coprocessor driver: snd_pci_acp6x
    v: kernel alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x, snd_acp_pci,
    snd_rpl_pci_acp6x, snd_pci_ps, snd_sof_amd_renoir, snd_sof_amd_rembrandt, snd_sof_amd_vangogh,
    snd_sof_amd_acp63 pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: e5:00.5 chip-ID: 1022:15e2
    class-ID: 0480
  Device-3: Advanced Micro Devices [AMD] Family 17h/19h HD Audio driver: snd_hda_intel v: kernel
    pcie: gen: 4 speed: 16 GT/s lanes: 16 bus-ID: e5:00.6 chip-ID: 1022:15e3 class-ID: 0403
  Device-4: Sunplus I
nnovation Full HD webcam driver: snd-usb-audio,uvcvideo type: USB rev: 2.0
    speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 3-1.1.4.2:13 chip-ID: 1bcf:2284 class-ID: 0102
    serial: <filter>
  API: ALSA v: k6.12.0-rc6-1-mainline-x64v3 status: kernel-api tools: N/A
  Server-1: PipeWire v: 1.2.6 status: active with: 1: pipewire-pulse status: active
    2: wireplumber status: active 3: pipewire-alsa type: plugin 4: pw-jack type: plugin
    tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Realtek RTL8125 2.5GbE driver: r8169 v: kernel pcie: gen: 2 speed: 5 GT/s lanes: 1
    port: f000 bus-ID: 02:00.0 chip-ID: 10ec:8125 class-ID: 0200
  IF: enp2s0 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Realtek RTL8852BE PCIe 802.11ax Wireless Network driver: rtw89_8852be v: kernel pcie:
    gen: 1 speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 03:00.0 chip-ID: 10ec:b852 class-ID: 0280
  IF: wlp3s0 state: down mac: <filter>
  Info: services: NetworkManager, smbd, sshd, systemd-timesyncd, wpa_supplicant
Bluetooth:
  Device-1: Realtek Bluetooth Radio driver: btusb v: 0.8 type: USB rev: 1.0 speed: 12 Mb/s lanes: 1
    mode: 1.1 bus-ID: 3-3:3 chip-ID: 0bda:b85b class-ID: e001 serial: <filter>
  Report: btmgmt ID: hci0 rfk-id: 0 state: up address: <filter> bt-v: 5.2 lmp-v: 11 status:
    discoverable: no pairing: no class-ID: 6c0104
Drives:
  Local Storage: total: 2.77 TiB used: 276.16 GiB (9.7%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Intel model: SSDPEKNU020TZ size: 1.86 TiB block-size:
    physical: 512 B logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter> fw-rev: 003C
    temp: 71.8 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Crucial model: CT1000MX500SSD1 size: 931.51 GiB block-size:
    physical: 4096 B logical: 512 B speed: 6.0 Gb/s tech: SSD serial: <filter> fw-rev: 043
    scheme: GPT
Partition:
  ID-1: / raw-size: 1.86 TiB size: 1.86 TiB (100.00%) used: 276.16 GiB (14.5%) fs: btrfs
    dev: /dev/dm-0 maj-min: 254:0 mapped: luks-2bdec0d6-999c-4a5a-9278-70a5c8e236d9
  ID-2: /boot/efi raw-size: 300 MiB size: 299.4 MiB (99.80%) used: 728 KiB (0.2%) fs: vfat
    dev: /dev/nvme0n1p1 maj-min: 259:1
  ID-3: /home raw-size: 1.86 TiB size: 1.86 TiB (100.00%) used: 276.16 GiB (14.5%) fs: btrfs
    dev: /dev/dm-0 maj-min: 254:0 mapped: luks-2bdec0d6-999c-4a5a-9278-70a5c8e236d9
  ID-4: /var/log raw-size: 1.86 TiB size: 1.86 TiB (100.00%) used: 276.16 GiB (14.5%) fs: btrfs
    dev: /dev/dm-0 maj-min: 254:0 mapped: luks-2bdec0d6-999c-4a5a-9278-70a5c8e236d9
  ID-5: /var/tmp raw-size: 1.86 TiB size: 1.86 TiB (100.00%) used: 276.16 GiB (14.5%) fs: btrfs
    dev: /dev/dm-0 maj-min: 254:0 mapped: luks-2bdec0d6-999c-4a5a-9278-70a5c8e236d9
Swap:
  Kernel: swappiness: 133 (default 60) cache-pressure: 100 (default) zswap: no
  ID-1: swap-1 type: zram size: 27.15 GiB used: 7.61 GiB (28.0%) priority: 100 comp: lzo-rle
    avail: lzo max-streams: 16 dev: /dev/zram0
Sensors:
  System Temperatures: cpu: 73.2 C mobo: 65.5 C gpu: amdgpu temp: 63.0 C
  Fan Speeds (rpm): N/A
Info:
  Memory: total: 28 GiB available: 27.15 GiB used: 14.66 GiB (54.0%)
  Processes: 486 Power: uptime: 14h 16m states: freeze,mem,disk suspend: s2idle avail: deep
    wakeups: 0 hibernate: platform avail: shutdown, reboot, suspend, test_resume image: 10.85 GiB
    services: org_kde_powerdevil, power-profiles-daemon, upowerd Init: systemd v: 256
    default: graphical tool: systemctl
  Packages: 1561 pm: pacman pkgs: 1556 libs: 397 tools: octopi,paru pm: flatpak pkgs: 5
    Compilers: gcc: 14.2.1 Client: shell wrapper v: 5.2.37-release inxi: 3.3.36
Garuda (2.6.26-1):
  System install date:     2024-09-26
  Last full system update: 2024-11-05 ↻
  Is partially upgraded:   No
  Relevant software:       snapper NetworkManager dracut
  Windows dual boot:       Probably (Run as root to verify)
  Failed units:            archlinux-keyring-wkd-sync.service 

Answering my own question(must be ran as root):
/usr/local/bin/hdled.sh

#!/bin/bash

# Check interval seconds
VMSTAT_INTERVAL=0.1

# Console output device
CONSOLE=/dev/console

# Indicator for LED control (caps, num, scroll)
INDICATOR="scroll"

# Function to get vmstat data and print it
getVmstat() {
  cat /proc/vmstat | grep -E "pgpgin|pgpgout" 
}

# Turn the LED on
function led_on() {
    setleds -L +${INDICATOR} < ${CONSOLE}
}

# Turn the LED off
function led_off() {
    setleds -L -${INDICATOR} < ${CONSOLE}
}

# Initialize variables
NEW=$(getVmstat)
OLD=$(getVmstat)

while [ 1 ] ; do
  sleep $VMSTAT_INTERVAL # Slow down a bit
  NEW=$(getVmstat)
  if [ "$NEW" = "$OLD" ]; then
    led_off ## No change, LED off
  else
    led_on  ## Change detected, LED on 
  fi
  OLD=$NEW
done

Systemd Service file (/etc/systemd/system/hdled.service)

[Unit]
Description=Keyboard HD LED
Wants=network.target
After=syslog.target network-online.target

[Service]
Type=simple
ExecStart=/usr/local/bin/hdled.sh
Restart=on-failure
RestartSec=10
KillMode=process

[Install]
WantedBy=multi-user.target

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.