Skip to content
View in the app

A better way to browse. Learn more.

Armbian Community Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

SSD Unexpected_Power_Loss / POR_Recovery_Count on Reboot

Featured Replies

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?  

  • Author

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..

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

 

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?

 

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.

 

 

 

Guest
This topic is now closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.