tjay Posted November 27, 2020 Share Posted November 27, 2020 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 More sharing options...
tjay Posted November 29, 2020 Author Share Posted November 29, 2020 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.. 2 Link to comment Share on other sites More sharing options...
gprovost Posted November 30, 2020 Share Posted November 30, 2020 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 More sharing options...
ShadowDance Posted November 30, 2020 Share Posted November 30, 2020 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 More sharing options...
aprayoga Posted December 2, 2020 Share Posted December 2, 2020 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 More sharing options...
Recommended Posts