Hard Disk wake up very frecuently

Re: Hard Disk wake up very frecuently

Postby serram » Sat Sep 12, 2020 9:13 pm

fvdw wrote:SMART isn't causing disk spin up. There must some activity in your LAN connecting to your NAS. To test you could disconnect LAN cable of the nas and see if spin up still occurs.


Ok, I've been more than 24 hours testing the disk with the LAN cable disconnected.
And nothing has changed. The disk is doing spin up and spin down constantly.
So... we must conclude that the guilty of this situation is the SMART function of the disk?

I only have clear that spin up and spin down again and again, several times by hour, is not a good behavior for the disk health.

So, what option do you think is better?
1. Always spining disabling the "spin down during inactivity period"?
2. Or getting that the disk remain still until there are access to the data on the disk by disabling SMART function.

I don't know how to do any of these options (I think it can't be done using fvdw-sl firmware interface), but I think I need to do something to prevent the disk failure due to spin up and down constantly.
serram
Donator VIP
Donator VIP
 
Posts: 29
Joined: Thu Aug 27, 2020 7:21 pm

Re: Hard Disk wake up very frecuently

Postby serram » Sat Sep 12, 2020 9:18 pm

Jocko wrote:Usually it is not a good idea to disable SMART on a disk as without it you can not detect a pre-fail state


I'm totally agree, but what would you do in my situation?
serram
Donator VIP
Donator VIP
 
Posts: 29
Joined: Thu Aug 27, 2020 7:21 pm

Re: Hard Disk wake up very frecuently

Postby Jocko » Sun Sep 13, 2020 7:39 am

Hi

Before using this way, I'd rather to deepen first why your disk spins up regularly.

The first step is right
serram wrote:Ok, I've been more than 24 hours testing the disk with the LAN cable disconnected.
And nothing has changed. The disk is doing spin up and spin down constantly.
As now we know it is not an host on your lan (or wan request) which occurs that.

Now need to deepen on the nas side: please to post
Code: Select all
ps axf
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hard Disk wake up very frecuently

Postby serram » Sun Sep 13, 2020 11:02 pm

Ok, this is the output:
Code: Select all
root@fvdwsl-base:/ # ps axf
  PID TTY      STAT   TIME COMMAND
    2 ?        S      0:00 [kthreadd]
    4 ?        I<     0:00  \_ [kworker/0:0H]
    5 ?        I      0:00  \_ [kworker/u2:0]
    6 ?        I<     0:00  \_ [mm_percpu_wq]
    7 ?        S      0:00  \_ [ksoftirqd/0]
    8 ?        I      0:02  \_ [rcu_preempt]
    9 ?        I      0:00  \_ [rcu_sched]
   10 ?        I      0:00  \_ [rcu_bh]
   11 ?        I<     0:00  \_ [netns]
  276 ?        S      0:00  \_ [oom_reaper]
  277 ?        I<     0:00  \_ [writeback]
  279 ?        I<     0:00  \_ [crypto]
  280 ?        I<     0:00  \_ [kintegrityd]
  282 ?        I<     0:00  \_ [kblockd]
  288 ?        I<     0:00  \_ [ata_sff]
  306 ?        I<     0:00  \_ [md]
  398 ?        I<     0:00  \_ [rpciod]
  399 ?        I<     0:00  \_ [xprtiod]
  400 ?        S      0:00  \_ [kswapd0]
  411 ?        I<     0:00  \_ [nfsiod]
  412 ?        I<     0:00  \_ [cifsiod]
  413 ?        I<     0:00  \_ [cifsoplockd]
  414 ?        S      0:00  \_ [jfsIO]
  418 ?        S      0:00  \_ [jfsCommit]
  419 ?        S      0:00  \_ [jfsSync]
  420 ?        I<     0:00  \_ [xfsalloc]
  421 ?        I<     0:00  \_ [xfs_mru_cache]
  562 ?        S      0:00  \_ [scsi_eh_0]
  563 ?        I<     0:00  \_ [scsi_tmf_0]
  567 ?        I<     0:00  \_ [smflush]
  572 ?        S      0:00  \_ [spi0]
  573 ?        I      0:00  \_ [kworker/u2:3]
  643 ?        S<     0:00  \_ [aoe_tx0]
  644 ?        S<     0:00  \_ [aoe_ktio0]
  659 ?        I<     0:00  \_ [raid5wq]
  662 ?        I<     0:00  \_ [dm_bufio_cache]
  663 ?        I<     0:00  \_ [kmpathd]
  664 ?        I<     0:00  \_ [kmpath_handlerd]
  682 ?        I<     0:00  \_ [ipv6_addrconf]
  685 ?        I<     0:00  \_ [dsa_ordered]
  713 ?        I<     0:00  \_ [kworker/0:1H]
  714 ?        S      0:00  \_ [jbd2/sda7-8]
  715 ?        I<     0:00  \_ [ext4-rsv-conver]
  735 ?        S      0:00  \_ [jbd2/sda2-8]
  736 ?        I<     0:00  \_ [ext4-rsv-conver]
  765 ?        I<     0:00  \_ [iscsi_eh]
  785 ?        S      0:00  \_ [jbd2/sda5-8]
  786 ?        I<     0:00  \_ [ext4-rsv-conver]
 1257 ?        S      0:00  \_ [jbd2/sda8-8]
 1258 ?        I<     0:00  \_ [ext4-rsv-conver]
 3895 ?        I      0:00  \_ [kworker/0:1]
 3935 ?        I      0:00  \_ [kworker/0:0]
 3940 ?        I      0:00  \_ [kworker/0:2]
    1 ?        Ss     0:02 init
  774 ?        Ss     0:00 /usr/sbin/buttonsd
  937 ?        S<s    0:00 /sbin/udevd --daemon
 1308 ?        Ss     0:05 /usr/bin/httpd -f httpd.conf -d /etc
 1309 ?        S      0:05  \_ /usr/bin/httpd -f httpd.conf -d /etc
 1554 ?        S      0:04  \_ /usr/bin/httpd -f httpd.conf -d /etc
 1312 ?        Ss     0:24 /usr/sbin/noflushd -n 30 /dev/sda
 1341 ?        Ss     0:00 /usr/bin/discoverd
 1349 ?        Ss     0:00 /usr/bin/rpcbind
 1367 ?        Ss     0:00 dropbear -p 22 -r /rw_fs/etc/dropbear/dropbear_rsa_host_key
 3939 ?        Ss     0:00  \_ dropbear -p 22 -r /rw_fs/etc/dropbear/dropbear_rsa_host_key
 3941 pts/0    Ss     0:00      \_ -sh
 4387 pts/0    R+     0:00          \_ ps axf
 1386 ?        Ss     0:00 /usr/sbin/hostd 7200
 1432 ?        Ssl    0:00 /usr/local/bin/minidlna -f /direct-usb/minidlna/minidlna.conf -P /var/run/minidlna.pid
 1459 ?        Ss     0:08 /usr/sbin/nmbd -D -l /var/log/samba
 1461 ?        Ss     0:00 /usr/sbin/smbd -D -l /var/log/samba
 1468 ?        S      0:00  \_ /usr/sbin/smbd -D -l /var/log/samba
 1470 ?        S      0:00  \_ /usr/sbin/smbd -D -l /var/log/samba
 1552 ?        Ss     0:01 /bin/ntpd -p time.windows.com -p pool.ntp.org

minidlna or ntpd could be probable suspects.
What do you think?

This is how it looks the time/date config in the web interface:
You do not have the required permissions to view the files attached to this post.
serram
Donator VIP
Donator VIP
 
Posts: 29
Joined: Thu Aug 27, 2020 7:21 pm

Re: Hard Disk wake up very frecuently

Postby Jocko » Mon Sep 14, 2020 7:37 am

Hi

So at least the debug mode is not activated :thumbup (because in this case syslog may write debug information in ivar/log/messages
I do not think ntpd may spin up regularily your disk (it reads/writes nothing on it)

yes, minidlna may do it but also hostd daemon

So we go to test first hostd. So do
Code: Select all
killall hostd
check if is no longer running with ps command. Then remove your lan wire and monitor if the disk spins up for one or two hours.

If not, restart it
Code: Select all
hostd 7200
and we go to check minidlna.
So stop it (from its menu) and remove again the lan wire and look at the nas behaviour.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hard Disk wake up very frecuently

Postby Mijzelf » Mon Sep 14, 2020 11:16 am

Some time ago I wrote a script to log all disk activity on a NAS. Maybe it's helpful here?

Code: Select all
#!/bin/sh

currentlog=/dev/null
cyclic=yes

InitialWait()
{
   # Sleep 5 seconds to let the disks sleep
   # Of course this can be done with a single sleep, but then you'll have to wait
   # before the pid file is cleaned up
   startdelay=$1
   minutes=0
   while [ $startdelay -gt $minutes ] ; do
      for seconds in 00 05 10 15 20 25 30 35 40 45 50 55
      do
         echo "Start delay active ${minutes}:${seconds}/$startdelay:00" >/tmp/diskmon/status
         sleep 5
      done
      let minutes=minutes+1
   done
}


Log()
{
   # Clear logbuffer and enable logging
   dmesg -c >/dev/null

   echo 1 > /proc/sys/vm/block_dump
   echo "Logging active" >/tmp/diskmon/status
   touch /tmp/diskmon/log1
   touch /tmp/diskmon/log2

        if [ -f /tmp/diskmon/logseq ] ; then
                currentlog=/tmp/diskmon/` cat /tmp/diskmon/logseq | cut -d ' ' -f 1 `
        else
                currentlog=/tmp/diskmon/log1
                echo "log1 log2" >/tmp/diskmon/logseq
        fi

        [ "$1" = "restart" ] && echo "Logging restarted : ` date `" >>${currentlog}

        local oldstamp=HHMM

        while [ -d /tmp/diskmon/ ] ; do
                sleep 1
                filesize=` du $currentlog | awk '{print $1}' `
                if [ $filesize -gt 2048 ] ; then
                        if [ "$currentlog" = "/tmp/diskmon/log1" ] ; then
                                currentlog=/tmp/diskmon/log2
                                echo "log1 log2" >/tmp/diskmon/logseq
                        else
                                currentlog=/tmp/diskmon/log1
                                echo "log2 log1" >/tmp/diskmon/logseq
                                [ "${cyclic}" = "no" ] && exit 0
                        fi
                        rm $currentlog && touch $currentlog
                fi

                dmesg -c | grep -v "proc\|rootfs\|sysfs\|tmpfs\|devpts" >/tmp/diskmon/tmp
               
                if [ ` wc -c /tmp/diskmon/tmp | cut -d ' ' -f 1 ` -gt 0 ] ; then
                        local stamp=` date +%H%M `
                        [ "$stamp" != "$oldstamp" ]  && oldstamp=$stamp && echo "==== ` date ` ====" >>${currentlog}
                        cat /tmp/diskmon/tmp >>${currentlog}
                fi
        done
}

Cleanup()
{
        echo 0 >/proc/sys/vm/block_dump
        rm /var/run/diskmon.pid
        echo "Logging stopped : ` date `" >>${currentlog}
        echo "Logging stopped" >/tmp/diskmon/status
}

Daemon()
{
   mkdir -p /tmp/diskmon
   
   echo $$ >/var/run/diskmon.pid


   trap "Cleanup" INT TERM EXIT
   InitialWait $1
   Log $2
}

Daemon $1 $2 >/dev/null 2>&1 &

It can be started (as root) with
Code: Select all
sh <scriptname> 15
which let the script sleep for 15 minutes, to give you the possibility to log out and and leave the NAS alone. The logs are written to /tmp/diskmon/ , If that's not in ram the script has to be adjusted to write to a place on a ramdrive. (You don't want to log the logger)
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: Hard Disk wake up very frecuently

Postby Jocko » Mon Sep 14, 2020 11:58 am

Thank you Mijzelf !

Mijzelf wrote:The logs are written to /tmp/diskmon/ , If that's not in ram the script has to be adjusted to write to a place on a ramdrive.
Yes it is our case but we have a tmpfs mounted on /tmp/usr/var. So need to write here the logs
(and also compile trap command, currently not available on fvdw-sl)

However there is a line I do not understand fully
Code: Select all
Daemon $1 $2 >/dev/null 2>&1 &
So reuse the 2d argument of the user command line but only a wait delay is used ($1) and log() does not seem to expect an argument (perhaps in another script version it was the filesize of log1 and log2 ?)
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hard Disk wake up very frecuently

Postby Mijzelf » Mon Sep 14, 2020 2:00 pm

Jocko wrote:(and also compile trap command, currently not available on fvdw-sl)
Realy? Didn't know it's not an internal command. Does it cost a lot? The only reason for trap is to be able to stop the script cleanly with kill. But of course the script can be extended with a 'stop' command which does the cleanup (and kill the daemon)

However there is a line I do not understand fully
Code: Select all
Daemon $1 $2 >/dev/null 2>&1 &
So reuse the 2d argument of the user command line but only a wait delay is used ($1) and log() does not seem to expect an argument (perhaps in another script version it was the filesize of log1 and log2 ?)

Possibly. It's several years ago I wrote this, and I can't remember. If I would write it now, I'd use "$@" instead of $1 $2.
Mijzelf
 
Posts: 255
Joined: Wed Nov 21, 2012 9:12 am

Re: Hard Disk wake up very frecuently

Postby Jocko » Mon Sep 14, 2020 2:55 pm

Oups...
You are right trap is a command of the shell. So no issue with it.

I go to make a test with my updated version before posting it
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

Re: Hard Disk wake up very frecuently

Postby Jocko » Mon Sep 14, 2020 5:06 pm

Hi serram,

We go to use the Mijzelf's script and see what I/O sequences you have on your nas.

To install it easily do
Code: Select all
plugout download 6496
tar -xf  /tmp/fvdw-sl-18-2-disk-monitoring.tgz
This will store a script 'diskmon' in /usr/sbin

So keep running all usual processes and do
Code: Select all
diskmon 15
check if diskmon daemon is running (ps axf)
Then remove the lan wire (to avoid any remote request from your LAN or WAN) and after a first disk spin down event (so 30min with your settings) look at when the disk spins up again.
In this case plug again the wire lan and open a shell session.
Stop diskmon daemon
Code: Select all
killall diskmon
and read the content of log1 or log2 in /usr/var/diskmon
Code: Select all
cat /usr/var/diskmon/log1
cat /usr/var/diskmon/log2
cat /usr/var/diskmon/status


Warning: if your reboot the nas, you will lose these files! So store the files in another location if you want keep them
You do not have the required permissions to view the files attached to this post.
Jocko
Site Admin - expert
 
Posts: 11529
Joined: Tue Apr 12, 2011 4:48 pm
Location: Orleans, France

PreviousNext

Return to Lacie cloudbox (white casing)

Who is online

Users browsing this forum: No registered users and 17 guests