Raspberry Pi 3 not shutting down external HDD

Hi, first of all, sorry if this question is already solved. I looked for that but found nothing.
I have a Raspberry Pi B model (incredibly slow :slight_smile: ) with OSMC (last version I think) and I have an external HDD 2.5" on a self powered hub. This works fine and when I turn off the RPI, the HDD also turns off even being connected to the power. This is great!

I’ve just got a Raspberry Pi 3 B model with OSMC last version (yesterday I did the upgrade), and when turning off the RPI3, the HDD doesn’t turns off and keeps spinning forever.

Could anyone tell me why and how to solve it? Many thanks

Regards

Unlikely without further (more detailed) information. You could start by running grab-logs -A and also tell us what the USB hub is and the make/model of disk.

A good test would also be to return the old Pi B and see if it still spins down.

Thanks for your reply! It’s a good idea, I’ll test it tonight. And I’m gonna test also this post because maybe it will solve this problem. OSMC not properly unmounting disks at reboot/shutdown [SOLVED - false issue] - #2 by sam_nazarko

Thank you!

EDIT 1:

Ok, I’ve tried again with the RPI 1B and the HDD is correctly shutted down. I’ve check both versions (Kodi and OSMC) in both devices (RPI 1 and RPI 3). Obviously they have distinct versions:

Raspberry Pi 1
> grep Kodi .kodi/temp/kodi.log | head -3
20:13:46.834 T:3025838080 NOTICE: Starting Kodi (17.1). Platform: Linux ARM 32-bit
20:13:46.834 T:3025838080 NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
20:13:46.834 T:3025838080 NOTICE: Kodi compiled Mar 20 2017 by GCC 4.9.2 for Linux ARM 32-bit version 3.16.7 (200711)

> grep VERSION_ID /etc/os-release
VERSION_ID="2017.03-1"

Raspberry Pi 3
> grep Kodi .kodi/temp/kodi.log | head -3
21:08:20.934 T:1958989824 NOTICE: Starting Kodi (17.1). Platform: Linux ARM (Thumb) 32-bit
21:08:20.934 T:1958989824 NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
21:08:20.934 T:1958989824 NOTICE: Kodi compiled May 2 2017 by GCC 4.9.2 for Linux ARM (Thumb) 32-bit version 3.16.39 (200743)

> grep VERSION_ID /etc/os-release
VERSION_ID="2017.04-1"

This might be the reason why they works different. I’m gonna upgrade the RPI 1 to check if now, with the same version as RPI 3 the HDD is not shutting down.

BTW, this trick OSMC not properly unmounting disks at reboot/shutdown [SOLVED - false issue] - #2 by sam_nazarko doesn’t fix this issue, but mounts/unmounts correctly all devices, so now I can hide the EFI partition assigning the option noauto.

I’ll update this post with the results.

Thanks

EDIT 2:

I’ve just upgraded RPI 1 to lastest version via apt-get update and dist-upgrade and I got:
> grep Kodi .kodi/temp/kodi.log | head -3
23:58:19.976 T:3025575936 NOTICE: Starting Kodi (17.1). Platform: Linux ARM 32-bit
23:58:19.976 T:3025575936 NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
23:58:19.977 T:3025575936 NOTICE: Kodi compiled Apr 10 2017 by GCC 4.9.2 for Linux ARM 32-bit version 3.16.7 (200711)

> grep VERSION_ID /etc/os-release
VERSION_ID="2017.04-1"

This version is still working fine shutting down HDD before shutting down itself. I’m trying to upgade again but no updates are found, so I believe this is the lastest version for Pi 1 which is distinct to version for Pi 3.

My next step will be downgrade the Kodi version for Pi 3 to “Kodi compiled Apr 10 2017 by GCC 4.9.2 for Linux ARM 32-bit version 3.16.7 (200711)” and check if Pi 3 is shutting down the HDD or not. I’ll edit soon. Thanks

Ok, I could downgrade the OSMC version for RPI 3 to “2017.03-1” and Kodi to “22 March” instead of “20 March as RPI 1” (maybe is the equivalent). In this version of OSMC and Kodi on RPI 3 the HDD doesn’t shuts down when it does RPI. So it seems to be some problem of RPI 3 hardware or a problem of OSMC/Kodi for RPI 3. Maybe is a bug? Can someone confirm that?

Thank you very much

I don’t have a Pi 1 so I’m a bit blind here, but could you look in file /etc/udisks-glue.conf on the Pi 1 and list the section labeled “match disks” near the bottom. I’m curious to see if it differs from the one on the Pi 3.

A few other points:

  1. You talk about “turning off” and “shutting down”. Just to be clear, this is a poweroff, not just stopping Kodi, right? (I assume you know these devices are designed to run continuously and not to be switched on/off regularly.)

  2. If you run the following on the Pi 3:

    sudo systemctl stop mediacenter
    sudo hdparm -y /dev/sdX
    (substitude the correct device letter) does the disk spin down?

I talk about poweroff, I poweroff RPI every night to save power. I know they are designed to run continuously, but I used to switch it off.

I could retrieve the info you asked me, here are both scripts:

Raspberry Pi 1:

match disks {                                                                                                                          
        post_insertion_command = '                                                                                                     
                if [ $(/bin/lsblk -n -d -o RM "%device_file") -eq 1 ] || [ $(/bin/lsblk -n -d -o ROTA "%device_file") -eq 0 ]; then                                                                                                                            
                        device=$(/bin/lsblk -n -d -o MAJ:MIN,TYPE -s "%device_file" | grep disk | sed "s/[^0-9:]*//g")                 
                        echo 1024 | sudo tee "/sys/dev/block/$device/queue/read_ahead_kb" > /dev/null                                  
                else                                                                                                                   
                        sudo /sbin/hdparm -S 240 %device_file                                                                          
                fi'                                                                                                                    
} 

Raspberry Pi 3:

match disks {                                                                                                                          
        post_insertion_command = '                                                                                                     
                if [ $(/bin/lsblk -n -d -o RM "%device_file") -eq 1 ] || [ $(/bin/lsblk -n -d -o ROTA "%device_file") -eq 0 ]; then                                                                                                                            
                        device=$(/bin/lsblk -n -d -o MAJ:MIN,TYPE -s "%device_file" | grep disk | sed "s/[^0-9:]*//g")                 
                        echo 1024 | sudo tee "/sys/dev/block/$device/queue/read_ahead_kb" > /dev/null                                  
                else                                                                                                                   
                        sudo /sbin/hdparm -S 240 %device_file                                                                          
                fi'                                                                                                                    
}                                                                                                                                      

I see no difference :S

I also ran the commands you say and I noticed that this HDD doesn’t support hdparm. However on RPI1 it spins down when RPI1 is powered off, and keeps running on RPI3 shut down. Later I found another HDD and I tried on RPI3. With hdparm -y it spins down correctly and starts running when I access to it, but when I power off the RPI 3 the HDD keeps running.

I would try the same on RPI1, but this HDD is not recognized on it, it’s wierd… (I tried fdisk -l but still not recognized) and when I power off the RPI1 this disk keeps running because it isn’t recognized. I’m lost right now :frowning:

There used to be a difference but I don’t have a Pi 1, which is why I asked you to look.

Your situation is perplexing and might possibly be a result of your USB hub - or simply that the disks are behaving differently. We know that USB-SATA interfaces are often very buggy.

There is another program called hd-idle that might work when hdparm doesn’t. You’ll need to compile it yourself, however. The main page for hd-idle can be found here and I found some quite detailed instructions for building it here

If you make any progress, please let us know.

What skin are you using? Skins that have “recently added” or similar widgets built into them, will consistently poll the media locations for changes/additions.

@ActionA @dillthedog
The guy is shutting down his Pi!!!
He is referring to the fact that his harddisk is not spinning down after the Pi is Shutdown means there seems to be something on a Pi USB level different between Pi 1 and 3.
Definetly not skin or any OSMC part related

Ok, I’ll continue testing and I’ll let u know. Thanks!

I have the default Kodi skin, which is included in OSMC.

Yes, you understood me! Maybe you are right. However, I’ve just bought a new power adapter for RPi3 with 3A (current one is 2A and when y connect my HDD directly on RPi, it spins but is not recognized) and I’ll try to connect this HDD directly on Pi3. With this mode when I shut down the RPI, the HDD will get the power cut. Additionally, I’m thinking in buying a new HDD with support for hdparm, because this HDD has at least 12 years LOL.

Thank you very much to all! I’ll let you know when I get my new power adapter.

Hi all! I got a new power adapter 3000mAh. Still doesn’t recognize the current HDD. But I got another HDD USB 3.0 more modern and RPI 3 recognizes it even without a self powered hub and without setting max_usb_current=1, so this is amazing. I noticed too that with this HDD RPI 3 is correctly spinning down the HDD before shutting down itself, so my problem is now fixed, and improved because I don’t need an external USB hub :smiley:

Maybe the previous HDD was too old to work with the RPI 3 but not for RPI 1.

So my problem was fixed using a newer HDD.

Thank you all!