Lubuntu

NAS server: frequent spontaneous disk spin-ups from standby

7 1594
Edited by MrTallyman at Mon Jun 1, 2015 01:34

Hi,
I've connected a SATA drive to the Banana Pi to make a NAS server. The disk goes into sleep mode if unused for more then 5 minutes. Howver, it wakes up frequently without any requests from client computers. I should mention I've placed a swap partition on that disk.

What's causing the spontaneous disk wake-ups?

How can I avoid unwanted disk activity?

Best regards,
Harry
hawhill  
I guess it will cease as soon as you disable swap. Did you try? It's just a "swapoff -a" away...

tkaiser  
Edited by tkaiser at Mon Jun 1, 2015 03:13

In case it's not swap activity you could use tools like fuser, atop, lsof or fatrace to have a look which processes do access a disk/partition.

Edited by MrTallyman at Thu Jun 4, 2015 17:20

Thanks for the hints. I don't want to disable swapping completely since the Banana Pi doesn't have much RAM. So I decided to reduce "swappiness" a bit by adding this line to /etc/sysctl.conf
  1. vm.swappiness=10
Copy the Code
I'll listen carefully to the NAS server whether spontaneous spin-ups have gone.

I'm not sure it's swapping. Could as well be from network requests? Computers checking if the NAS drive is still there? I'll try the recommended tools later.

BTW, I don't use the NAS drive quite often. I'm thinking of sleeping the entire Banana Pi and use Wake-On-LAN. Does it have this feature?

Best regards,
Harry

hawhill  
No, I don't think it does Wake-On-LAN. The network controller is a bit too basic for that.

When there are computers that have the NAS mounted, of course they might be running applications that will sporadically access them. Enable proper access logging on your NAS to see if that's the case.

For a NAS, the Pi does really have a lot of RAM, I think. In order to investigate whether it is swapping, you can run "vmstat" and have a look at the "si" and "so" values. You can also look at /proc/swaps in order to see if swap is used on your system at all.

Edited by MrTallyman at Fri Jun 5, 2015 02:36

One change I realized, the HDD didn't wake up when I started an ssh session today. It did so before I lowered the 'swappiiness'.
  1. vmstat
  2. procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
  3. r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
  4. 0  0      0 348808  50804 292492    0    0     5     2  120   57  0  0 100  0  0
  5. root@lemaker:~# vmstat
  6. procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
  7. r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
  8. 0  0      0 347692  50848 292516    0    0     4     2  120   56  0  0 100  0  0
  9. root@lemaker:~# vmstat
  10. procs -----------memory---------- ---swap-- -----io---- -system-- ------cpu-----
  11. r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
  12. 0  0      0 346668  50872 292516    0    0     4     1  120   56  0  0 100  0  0
Copy the Code
'Lots' of free RAM, no swaps so far. I'll keep watching it.

hawhill  
all shown memory values, except the "swpd" ones, should be considered "freeable" memory - (block) buffer and (filesystem) cache can be freed if the memory is actually needed by programs for stuff.

To "keep watching it", run vmstat with a numeric parameter n, which will tell vmstat to report in intervals of n seconds about the i/o during the last n seconds. Otherwise, vmstat will always present overall stats. So run it e.g. with "vmstat 5" to report in 5-second intervals. CTRL-C will exit.

Great, thank you!

No unnecessary spinups so far. Still watching...

You have to log in before you can reply Login | Sign Up

Points Rules