Skip to content
Contents
GuidesOpenWrt

OpenWrt memory stays high after a Samba copy. When should you act?

A finished copy on your computer can leave writes pending on the router. Before clearing anything, separate filesystem cache, available memory and the memory held by smbd.

A finished copy on your computer can leave writes pending on the router. Before clearing anything, separate filesystem cache, available memory and the memory held by smbd.

Take readings before the copy, at completion and after an idle interval

For Samba 4, check free disk space and use an ordinary file. Run this block over SSH on the router at each point. Keep timestamps and PIDs. If smbd is absent, check whether the service is running or you use kernel ksmbd, where the process test does not apply.

date
grep -E '^(MemAvailable|Cached|Dirty|Writeback|Shmem|SReclaimable):' /proc/meminfo
for p in $(pidof smbd); do echo PID=$p; grep -E '^(VmRSS|RssAnon):' /proc/$p/status; done
grep -E '^(pgscan|pgsteal)' /proc/vmstat | head -8
SSH · /proc/meminfo · smbd · /proc/vmstat
OpenWrt 25.12.6 · x86/64 · QEMU · Samba 4.22.7 · This separate snapshot shows system totals first and process readings under each PID.

In a separate VM loopback test we uploaded and read back 2 MiB with matching SHA-256 hashes. Eight seconds later Cached had risen from 269312 to 273592 kB and MemAvailable from 453540 to 453936 kB. Both can rise together. This small test does not measure external disk behavior or sustained reclaim.

kB              t0       t1      t1+8s
Cached         269312   273524   273592
MemAvailable   453540   453980   453936

Decide which change matters

  • Dirty tracks data awaiting writeback. Writeback tracks work in progress. Keep sampling. If a backlog persists alongside disk errors in dmesg, pause new copies, keep the source and leave the drive connected.
  • High Cached with stable MemAvailable and responsive services can be left alone. Shmem overlaps cache accounting. Rising pgsteal counters indicate system reclaim without identifying a file. Flat counters may simply mean low pressure.
  • If MemAvailable falls after successive runs, compare RssAnon and VmRSS for the same PID. Start a new baseline if it changes. Summing shared pages across processes double counts memory. One high reading cannot establish a leak.

Reopen the destination from the client and compare checksums. Return to normal activity and verify both share access and the admin page. If stalls persist, keep all three samples and matching logs. The queries are read-only and need no rollback.

Why does LuCI show more than 100% memory for a process when ps shows less?

Explore hardware

Comments