× NETGEAR will be terminating ReadyCLOUD service by July 1st, 2023. For more details click here.
Orbi WiFi 7 RBE973
Reply

Re: Ready Nas 516 drive sleep issues with readynasd

HuwSy
Guide

Ready Nas 516 drive sleep issues with readynasd

Hi

Im a new Readynas user, just as they are retired and because my work decided to throw the 516 unit out with 5x 2TB drives included because they didn’t have the required support going forward. It’s already been through a multitude of wipes, resets etc to ensure there was no data included then been upgraded to the latest os. I have setup the options within the web ui to enable drive sleep, I have a few shares all with no access (no smb, ftp anything), the only enabled service is ssh as everything I use connects over this to the shares, all shares do have copy on write but don’t have defrag. I have disabled clamav, disabled the swap partition via systemctl mask, changed journaling to storage=none, moved /var/log /var/tmp /var/cache /var/readynasd /var/backups to tmpfs with startup and shutdown scripts, upped the vfs_cache_pressure dirty_ratio dirty_background_ratio to increase io caching in memory, stopped smb service all to reduce io activity in iotop and lsof which has reduced a lot but the drives still read about 450kb every other minute. The only thing that stops this is if I stop the readynasd service which is fine as I don’t need web interface once setup correctly but does mean I lose the temperature display on the front and maybe it’s shutdown on drive failure etc. is there anything else I should look at to what this service is doing with the drives, the best I can see in iotop is it’s something to do with enclosure monitor.

Thanks
Message 1 of 16
StephenB
Guru

Re: Ready Nas 516 drive sleep issues with readynasd

You shouldn't be needing such heroic measures. Can you confirm you are running 6.10.8?  ("latest" isn't that helpful).

 

My own NAS (an rn526) is set to sleep, but generally still spins up every 30-60 minutes during off-hours.  But I have an always-on PCs with the volume mapped to a drive letter, and some applications on that PC can and do access the volume at any time.  

 

You might want to enable block_dump, as described here:

 

There is a very old thread where the conclusion was that disabling ipv6 on the NAS resolved this issue.

While I'd hope that the underlying cause would have been fixed by now, I think it is worth a disabling ipv6 on the NAS as a test.

 

 

 

 

 

Message 2 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

Hi

Yes it’s 10.6.8. I have to fire up the service again to check versions.

I have disabled ipv6 just now and enabled block dump, will let it settle a little and see what it’s like later this afternoon. If all of this was just ipv6 then it will be slightly annoying but I think I have nicely tuned the disc usage down for what will be a system that spends most off its time completely idle in my case.

Thanks

Message 3 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

Disabling ipv6 on both nics made no difference and additional logging only shows enclosure monitor repeatedly dirtying and writing nodes which is nothing new from my findings with iotop. I still don’t know which files it’s hitting to move to cache though.

Although I have now taken the alternate route and setup msmtprc and mdadm to email and shutdown on failure and will use the nas without readynasd or apache2 or samba which are the biggest culprits, although it does reduce the attack surface given I can’t really update the Debian base here.

Or could I update Debian if I am not using more and more of Netgear software here?
Message 4 of 16
npandit
Aspirant

Re: Ready Nas 516 drive sleep issues with readynasd

Hello @HuwSy 

 

It seems like networking issue, network time out is occurring.
Could you please perform OS Reinstall and then monitor if issue appears again or not?

OS reinstall. Re-installs the firmware from the internal flash to the disks. Use the OS reinstall boot mode when the system crashes and corrupts some configuration files. OS reinstall boot mode also resets some settings on your storage system, such as Internet protocol settings and the administrator password, to defaults.

 

OS-reinstall is a safe method and the data is not impacted at all.

 

To access the boot menu:

Power off your storage system.
Using a straightened paper clip, press and hold the Reset button.
Press the Power button. The system powers on.
Continue to press the Reset button until the status display screen shows a boot menu message.
Release the Reset button.
Press the Up or Down arrows on the Touch-pad to scroll through boot mode options.The status display screen shows the current boot mode option.
When the status display screen shows the boot mode that you need, press the OK button in center of Touch-pad to confirm your boot menu selection.

 

Please find the link for more details : https://kb.netgear.com/23005/How-do-I-access-the-boot-menu-on-my-ReadyNAS-316-516-716

 

Have a lovely day, 
NiveditaPa
Netgear Team 
  

 

 

 

Message 5 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

Hi

I had previously tried this with a factory reset but experienced the same issues. I did notice the network connected, ip would pop up on display at random intervals but probably only every few hours not as often as the drive spin up. I have only 1 of the 2 NICs connected and the 2nd disabled in the web interface. Does this need or attempted both interfaces perhaps? If so I’ll need to disable or run another line as the rest of the network is already slower than this unit.

Thanks
Message 6 of 16
NiveditaP
NETGEAR Moderator

Re: Ready Nas 516 drive sleep issues with readynasd

Hello @HuwSy 

 

Factory Default and OS reinstall are different.

Could you please perform OS reinstall once and check again ?

 

Have a lovely day,
NiveditaPa
Netgear Team

Message 7 of 16
Sandshark
Sensei

Re: Ready Nas 516 drive sleep issues with readynasd

Factory Default is more than an OS Re-install.  If a default didn't fix it, an OS re-install certainly won't.  After the default, did you restore a saved configuration that may have restored the problem?  Did you install any apps or enable ReadyCloud?

Message 8 of 16
NiveditaP
NETGEAR Moderator

Re: Ready Nas 516 drive sleep issues with readynasd

Hello @HuwSy 

 

Please refer to the link for referring the setup of the Raidar : https://kb.netgear.com/22765/Basic-Setup-with-RAIDar

 

Have a lovely day,
Nivedita Pa
Netgear Team

 

Message 9 of 16
Sandshark
Sensei

Re: Ready Nas 516 drive sleep issues with readynasd

The NAS will work fine with one interface disabled.  It's not a good idea, though.  If one goes bad on you, you'll want the other active so you can swap the cable and re-gain access.

Message 10 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

Hi

Post factory reset I didn’t install anything other than add a few shares and remove services in the web interface so it’s only https, http and ssh accessible.

Tried an os reinstall again recently but still the same.
Message 11 of 16
StephenB
Guru

Re: Ready Nas 516 drive sleep issues with readynasd

Did you try enabling block_dump, and see if gives any clues?

Message 12 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

Hi

I have some time back, I can’t remember the exact output but the closest I ever got was something to do with btrfs and enclosure monitor but both stop if I kill readynasd. Nothing else seems to make any difference.

Thanks
Message 13 of 16
StephenB
Guru

Re: Ready Nas 516 drive sleep issues with readynasd


@HuwSy wrote:

I have some time back, I can’t remember the exact output but the closest I ever got was something to do with btrfs and enclosure monitor but both stop if I kill readynasd. Nothing else seems to make any difference.


If it's btrfs, it's likely some file system maintenance activity.

 

Personally I do set the drives to sleep, but don't pay much attention to the spinup timing.  One complication is that the system boots from the disks, so a variety of linux processes can require paging into memory, which of course will require spinup.

Message 14 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

The spin down noflushd does change a lot of the caching so only writes are likely to spin the disk up. But I have a feeling it’s the writes to Readynas logs about temperatures, networking etc that wake it, or writing data. If I could move the os to run from a flash it would be better, I’ve noticed some other manufacturers ones have this arrangement.
Message 15 of 16
HuwSy
Guide

Re: Ready Nas 516 drive sleep issues with readynasd

After much tinkering I have given up with readynasd as a service and made the parts I want to work. It was not a quick process but now I average 16+ hours between spin down and up.

 

Changed caching to 80% and removed the byte versions

/etc/sysctl.conf

vm.swappiness=1
vm.vfs_cache_pressure = 10
vm.dirty_background_ratio = 80
vm.dirty_ratio = 80
# vm.dirty_background_bytes
# vm.dirty_bytes

sysctl --system

 

Made sure it emails root on errors
/etc/mdadm/mdadm.conf

MAILADDR root
MAILFROM root

And add this at the end of the exec to trigger emails
/etc/systemd/system/multi-user.target.wants/mdadm.service

Exec... -m root

Updated the scheduled tasks all to 5-6am in /etc/crontab

Run snapper for all 0-5 shares I have
crontab -e

45 5 * * * for i in $(seq 0 5); do snapper --config=$i --quiet create --description="timeline" --cleanup-algorithm="timeline" ; done

Updated all the timers to about 5-6am, fresh clam about 5 min before daily scan

/lib/systemd/system/*.timer

 

Use as appropriate something like these in the above
OnCalendar=Thu 5:0
OnCalendar=*-*-* 04:55:00

 

And also remove any

OnUnitActiveSec=

 

Remove any unused services
systemctl mask fvbackup-q rn-update.timer radar.timer smb rpcbind.socket rpcbind
systemctl disable dev-md1.swap

 

Firewall and fan control app

/usr/sbin/noreadynas

#!/bin/bash
## Variables ##
FANPWMPATH=/sys/devices/platform/nct6775.2608/hwmon/hwmon1/pwm1
FANPWMENABLE=/sys/devices/platform/nct6775.2608/hwmon/hwmon1/pwm1_enable
FANSPEEDPATH=/sys/devices/platform/nct6775.2608/hwmon/hwmon1/fan1_input
CORETEMPPATH=/sys/devices/platform/nct6775.2608/hwmon/hwmon1/temp7_input
INTERNALDRIVES=/dev/sd[a-e]
MAXFAN=100 # Maximum operable speed
MINFAN=0 # Minimum operable speed
MINPWM=75 # PWM Limit
MAXPWM=255 # PWM Limit
MINTEMP=40 # Min temp -> Fan slowest
MAXTEMP=75 # Max temp -> Fan fastest
MINTEMPD=35 # Min drive temp -> Fan slowest
MAXTEMPD=60 # Max drive temp -> Fan fastest
NEWSPEED=65 # Initial fan speed (%)
## Functions ##
function getReadings {
  FANPWM=$(cat $FANPWMPATH)
  FANSPEED=$(cat $FANSPEEDPATH)
  CORETEMP=$(cat $CORETEMPPATH)
  if [ $CORETEMP -gt 1000 ]; then
    CORETEMP=$(expr $CORETEMP / 1000)
  fi
  DRIVETEMP=$(/sbin/hdparm -H $INTERNALDRIVES | sed -nr 's/[^0-9]*([0-9]+)/\1/p' | sort -r | head -n 1)
  echo "$CORETEMP,CPU,$DRIVETEMP,HDD,$(/sbin/hdparm -C $INTERNALDRIVES | grep active | wc -l),ACT,$FANSPEED,FAN" | systemd-cat -t fancontrol -p info
}
function calcFanPercent {
  TEMPRAN=$(expr $MAXTEMP - $MINTEMP)
  TEMPREL=$(expr $CORETEMP - $MINTEMP)
  TEMPPER=$(expr $TEMPREL \* 100 / $TEMPRAN)
  NEWSPEED=$TEMPPER
  TEMPRAN=$(expr $MAXTEMPD - $MINTEMPD)
  TEMPREL=$(expr $DRIVETEMP - $MINTEMPD)
  TEMPPER=$(expr $TEMPREL \* 100 / $TEMPRAN)
  if [ $TEMPPER -gt $NEWSPEED ]; then
    NEWSPEED=$TEMPPER
  fi
}
function setFanSpeed {
  if [ $NEWSPEED -lt $MINFAN ]; then
    NEWSPEED=$MINFAN
  fi
  if [ $NEWSPEED -gt $MAXFAN ]; then
    NEWSPEED=$MAXFAN
  fi
  NEWPWM=$(expr $MAXPWM - $MINPWM)
  NEWPWM=$(expr $NEWPWM \* $NEWSPEED)
  NEWPWM=$(expr $NEWPWM / 100)
  NEWPWM=$(expr $NEWPWM + $MINPWM)
  echo 1 > $FANPWMENABLE
  echo $NEWPWM > $FANPWMPATH
}
function ensureFirewall {
  if [ "$(/sbin/iptables -S | grep 'A INPUT -p tcp -m tcp --dport 22 -j ACCEPT')" = "" ]; then
    /sbin/iptables -A INPUT -p tcp --dport 22 -j ACCEPT
    /sbin/iptables -A INPUT -p tcp --dport 443 -j ACCEPT
    /sbin/iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
    /sbin/iptables -P INPUT DROP
  fi
}
###################
ensureFirewall
if [ "$1" != "" ]; then sleep "$1"; fi
systemctl stop apache2 apache2-safe readynasd radar dev-md1.swap
if ! cmp -s /etc/clamd.conf /etc/clamav/clamd.conf ; then
  cp /etc/clamd.conf /etc/clamav/
  systemctl restart clamav-daemon clamav-clamonacc
fi
while true
do
  getReadings
  calcFanPercent
  setFanSpeed
  ensureFirewall
  sleep 10
done
###################

chmod +x /usr/sbin/noreadynas

 

A service to run the app above
/lib/systemd/system/noreadynas.service

[Unit]
After=readynasd.service
[Service]
ExecStartPre=/bin/sleep 15
ExecStart=/usr/sbin/noreadynas 300
ExecStop=/sbin/iptables -P INPUT ACCEPT
ExecStopPost=/bin/systemctl start readynasd apache2
Restart=always
[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl enable noreadynas

 

Email on virus errors

/usr/sbin/clamsendmail

#!/bin/bash
echo -e "Subject: Virus Event $1\n$(journalctl | grep clamd | grep FOUND | tail -n 3)" | sendmail root

chmod +x /usr/sbin/clamsendmail

 

Because readynasd overwrites the clam config then copy and edit to be copied back as needed, main change is the self check and email sending but also swaping this to include paths so access prevention can be enabled
cp /etc/clamav/clamd.conf /etc/

/etc/clamd.conf

...
SelfCheck 86400
...
VirusEvent ... ; /usr/sbin/clamsendmail %v
...
# OnAccessMountPath
OnAccessIncludePath /root
OnAccessIncludePath /home/
OnAccessIncludePath /data/
OnAccessPrevention yes
OnAccessExtraScanning true
ExcludePath ^/var/lib/clamav/
ExcludePath ^/var/lib/clamav-unofficial-sigs/
ExcludePath ^/var/log/frontview/clamscan.log$

Because I dont want swap enabled then only raise with clam update then end after clam scan all around 5-6am

/lib/systemd/system/clamav-freshclam.service

ExecStartPre=/bin/systemctl start dev-md1.swap

/lib/systemd/system/antivirus-sched-scan.service

ExecStop=/bin/systemctl stop dev-md1.swap

Install vmtouch, wither from downloading from buster repo or from adding tbe repo to /etc/apt/sources.list and removing after
crontab -e

  @reboot sleep 120 && /usr/bin/vmtouch -F /bin /dev /etc /lib* /opt /proc /run /sbin /sys /usr /var -i nfs4 -I snmpconf
  54 4 * * * vmtouch -F /bin /dev /etc /lib* /opt /proc /run /sbin /sys /usr /var -i nfs4 -i snmpconf
  15 6 * * * vmtouch -e /data/ && vmtouch -F /bin /dev /etc /lib* /opt /proc /run /sbin /sys /usr /var -i nfs4 -i snmpconf

 

Message 16 of 16
Top Contributors
Discussion stats
  • 15 replies
  • 2285 views
  • 0 kudos
  • 5 in conversation
Announcements