Not helpful when CE is updating and and the HD goes CLUNK when it reboots lol
CE does not reboot automatically after updating if you don’t let it, to give you ample time to remove safely all your USB drives
Ah yeah thats true, but if i unplug the hdd it still goes clunk lol
I really don’t see why hdds can’t be automatically shut down before Coreelec turns off like win10 does? Oh well, it’s really not that hard to do before quitting-just 1 or 2 more remote button presses.
That would be great improvement, but according https://github.com/xbmc/xbmc/blob/aa39210197323230c1c2ab086a6f2a18f39daf9a/xbmc/storage/MediaManager.cpp Eject(mountpath) would need to be called before shutdown/poweroff.
But there must be some decision making whats removable disc (ie sdX or such).
I think its not too hard implement it only for AML (CE), but in optimal way (not workaround) this should be handled within Kodi itself.
shutdown.sh bash script is called on shutdown: https://wiki.libreelec.tv/autostart.sh
It should be easy to write a script to unmount all devices mounted under /media.
thats nice and easy option there, thanks. I will add umount commands for installations using USB HDD for /storage (as I think USB flashdrives are just fine).
Not sure if HDD shouldnt be handled also for restarts though…
Can you make such a “Shutdown.sh” for us that are not at home with Linux ?
Run this two commands in ssh console and check if reboot or powering off unmounts usb disks.
wget -O /storage/.config/shutdown.sh https://pastebin.com/raw/ypmbcrEu dos2unix /storage/.config/shutdown.sh
Is ‘umount’ a sufficient command?
Yes it will unmount the filesystem, but is ‘eject’ not required to withdraw power from the device?
… maybe that has changed …
Does Kodi eject really eject the drive or just unmount it? I think it only unmount.
I did, it downloaded and placed shutdown.sh in proper place, then I run the second command and turned off N2. When USB power was cut off disk “clanked” as it does when I don’t remove it safely in Kodi Power Menu. So this does not work for my USB disk…
Btw, my USB HD is mounted as /dev/sda1; should that be put in the command instead
Seems Kodi eject is doing something more.
You can try using hdparm like
hdparm -y /dev/sda
Running hdparm -y /dev/sda1
response: issuing standby command
and USB HD drive goes to sleep.
Then use this command after partitions are unmounted in shutdown.sh.
Where exactly do I put it, like this:
for usb_dev in /dev/disk/by-id/usb-*; do
dev=$(readlink -f $usb_dev)
grep -qw ^$dev /proc/mounts && umount $dev
hdparm -y /dev/sda1
for usb_dev in /dev/disk/by-id/usb-*; do dev=$(readlink -f $usb_dev) grep -qw ^$dev /proc/mounts && umount $dev hdparm -y $dev done
Or maybe better
for usb_dev in /dev/disk/by-id/usb-*; do dev=$(readlink -f $usb_dev) grep -qw ^$dev /proc/mounts && umount $dev done for usb_dev in /dev/disk/by-id/usb-*; do dev=$(readlink -f $usb_dev) hdparm -y $dev done
No change with the first version, will try second version later when wife lets me fiddle with the player again
EDIT, after some sweet talk I could try the second command also
But, no change with reboot or power off, the drive still goes “clank”. Checking in System Info after running dos2unix /storage/.config/shutdown.sh command my USB HD is still mounted and all content is accessible.
dos2unix command only changes dos formatted shell script to unix
If you want to execute manually run
sh /storage/.config/shutdown.sh poweroff
Well, no wander that there is no change
But also no luck with proper command:
CoreELEC:~ # sh /storage/.config/shutdown.sh poweroff
/dev/disk/by-id/usb-*: No such file or directory