Jump to content

SSD Unexpected_Power_Loss / POR_Recovery_Count on Reboot


tjay

Recommended Posts

Hi,

I’m using the Helios64 with Armbian 20.11 Buster ( 5.9.10-rockchip64)

 

On every reboot the SMART counter for  “Unexpected_Power_Loss (174)” /  “POR_Recovery_Count (235)”  incresses by one. I’ve seen this unexpected behaviour on Samsung, WD and Crusical SSDs …

 

Rebooting the box with

sync && echo 1 > /sys/block/sdX/device/delete && reboot

turns the disk friendly off, but shouldn’t this be done in systemd/kernel?  

Link to comment
Share on other sites

Inspired by this topic https://forum.odroid.com/viewtopic.php?t=29069 I installed a shutdown script in /lib/systemd/system-shutdown:

#!/bin/bash

case "$1" in
    kexec)
       # Do not park disks when switching kernels.
       ;;
    *)
       for disk in /sys/block/sd* ; do
         echo 1 > /sys/class/block/${disk##*/}/device/delete
       done
       sleep 1
        ;;
esac

this works for my needs.

 

I don’t know if this problem is Helios64 specific, if not please move this topic to armbian common issues..

Link to comment
Share on other sites

Good point indeed, we need to experiment to see to which extend it is really needed.

 

Experimenting with the following inspired from the odroid thread you shared

 

#!/bin/bash

# Wait mdadm arrays are in clean state
[ -x /sbin/mdadm ] && /sbin/mdadm --wait-clean --scan

# Choose hdparm param
systemctl list-jobs | egrep -q 'reboot.target.*start' && YVAL='Y' || YVAL='y'

# Park all SATA disks.
if [ -x /usr/sbin/hdparm ]; then
   for DEV in /sys/block/sd* ; do
      [ -e $DEV ] && /usr/sbin/hdparm -$YVAL /dev/${DEV##*/}
   done
   sleep 3
fi

for DEV in /sys/block/sd* ; do
   echo 1 > /sys/class/block/${DEV##*/}/device/delete
done

 

Link to comment
Share on other sites

I've also noted the sudden power loss to drives and that it only happens during reboot, not regular shut down. When doing a regular shut down the drives seem to shut down one at a time, and when reboot:ing they lose power simultaneously.

 

Now, I'm wondering, what happens if the system is running from the drives and we're using a systemd script to stop them? Is there a chance that they will spin up again because another script is loaded or something similar? It may be a stupid question but I'm not very familiar with systemd. I imagine it should be the very last thing that's executed before the actual restart.

 

Edit: Side-question, is it actually necessary to power cycle the drives during reboot? Or could they be left running? Might that require changes to u-boot perhaps?

Link to comment
Share on other sites

 

On 11/30/2020 at 8:01 PM, ShadowDance said:

Edit: Side-question, is it actually necessary to power cycle the drives during reboot? Or could they be left running? Might that require changes to u-boot perhaps?

Maybe it is not necessary and rely on SATA soft reset. U-Boot definitely needs to be modified to differentiate reboot and power on.

 

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines