Disk spin down does not work on some of my disks

As mentioned in the developer hread for 3.8-14 I’m having problems with getting disk spindown working on my SAMSUNG HD154UI’s

I was asked to run:

tail -f /opt/rockstor/var/log/rockstor.log

Outout was:

self._create_update_meta(r, rockons[r])

File “/opt/rockstor/eggs/Django-1.6.11-py2.7.egg/django/db/transaction.py”, line 371, in inner
return func(*args, **kwargs)
File “/opt/rockstor/src/rockstor/storageadmin/views/rockon.py”, line 169, in _create_update_meta
handle_exception(Exception(e_msg), self.request)
File “/opt/rockstor/src/rockstor/storageadmin/util.py”, line 52, in handle_exception
raise RockStorAPIException(detail=e_msg)
RockStorAPIException: Cannot add/remove container definitions for Plex as it is not in available state. Uninstall the Rock-on first and try again.
[02/May/2016 09:37:24] DEBUG [storageadmin.util:48] Current Rockstor version: 3.8-13.06
[02/May/2016 09:37:24] ERROR [smart_manager.data_collector:320] failed to update Rock-on metadata. low-level exception: Errors occurred while processing updates for following Rock-ons. Plex: Cannot add/remove container definitions for Plex as it is not in available state. Uninstall the Rock-on first and try again.
self._create_update_meta(r, rockons[r])
File “/opt/rockstor/eggs/Django-1.6.11-py2.7.egg/django/db/transaction.py”, line 371, in inner
return func(*args, **kwargs)
File “/opt/rockstor/src/rockstor/storageadmin/views/rockon.py”, line 169, in _create_update_meta
handle_exception(Exception(e_msg), self.request)
File “/opt/rockstor/src/rockstor/storageadmin/util.py”, line 52, in handle_exception
raise RockStorAPIException(detail=e_msg)
RockStorAPIException: Cannot add/remove container definitions for Plex as it is not in available state. Uninstall the Rock-on first and try again.
[02/May/2016 09:37:24] DEBUG [storageadmin.util:48] Current Rockstor version: 3.8-13.06
[02/May/2016 09:37:24] ERROR [smart_manager.data_collector:320] failed to update Rock-on metadata. low-level exception: Errors occurred while processing updates for following Rock-ons. Plex: Cannot add/remove container definitions for Plex as it is not in available state. Uninstall the Rock-on first and try again.

I dont see any mentions of HDPARM.

I was also asked to run udevadm info --query=property --name devNameOfASamsung:

udevadm info --query=property --name sda
DEVLINKS=/dev/disk/by-id/ata-SAMSUNG_HD154UI_S1XWJDWZ816538 /dev/disk/by-id/wwn-0xb22303ed4e905002 /dev/disk/by-label/RSPool /dev/disk/by-path/pci-0000:00:11.0-ata-1.0 /dev/disk/by-uuid/12bf3137-8df1-4d6b-bb42-f412e69e94a8
DEVNAME=/dev/sda
DEVPATH=/devices/pci0000:00/0000:00:11.0/ata1/host0/target0:0:0/0:0:0:0/block/sda
DEVTYPE=disk
ID_ATA=1
ID_ATA_DOWNLOAD_MICROCODE=1
ID_ATA_FEATURE_SET_AAM=1
ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=0
ID_ATA_FEATURE_SET_AAM_ENABLED=0
ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE=254
ID_ATA_FEATURE_SET_APM=1
ID_ATA_FEATURE_SET_APM_ENABLED=0
ID_ATA_FEATURE_SET_HPA=1
ID_ATA_FEATURE_SET_HPA_ENABLED=1
ID_ATA_FEATURE_SET_PM=1
ID_ATA_FEATURE_SET_PM_ENABLED=1
ID_ATA_FEATURE_SET_PUIS=1
ID_ATA_FEATURE_SET_PUIS_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY=1
ID_ATA_FEATURE_SET_SECURITY_ENABLED=0
ID_ATA_FEATURE_SET_SECURITY_ENHANCED_ERASE_UNIT_MIN=310
ID_ATA_FEATURE_SET_SECURITY_ERASE_UNIT_MIN=310
ID_ATA_FEATURE_SET_SECURITY_FROZEN=1
ID_ATA_FEATURE_SET_SMART=1
ID_ATA_FEATURE_SET_SMART_ENABLED=1
ID_ATA_SATA=1
ID_ATA_SATA_SIGNAL_RATE_GEN1=1
ID_ATA_SATA_SIGNAL_RATE_GEN2=1
ID_ATA_WRITE_CACHE=1
ID_ATA_WRITE_CACHE_ENABLED=1
ID_BUS=ata
ID_FS_LABEL=RSPool
ID_FS_LABEL_ENC=RSPool
ID_FS_TYPE=btrfs
ID_FS_USAGE=filesystem
ID_FS_UUID=12bf3137-8df1-4d6b-bb42-f412e69e94a8
ID_FS_UUID_ENC=12bf3137-8df1-4d6b-bb42-f412e69e94a8
ID_FS_UUID_SUB=8e9b9bb6-e872-407e-983b-b1c5c00097e8
ID_FS_UUID_SUB_ENC=8e9b9bb6-e872-407e-983b-b1c5c00097e8
ID_MODEL=SAMSUNG_HD154UI
ID_MODEL_ENC=SAMSUNG\x20HD154UI\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_PATH=pci-0000:00:11.0-ata-1.0
ID_PATH_TAG=pci-0000_00_11_0-ata-1_0
ID_REVISION=1AG01118
ID_SERIAL=SAMSUNG_HD154UI_S1XWJDWZ816538
ID_SERIAL_SHORT=S1XWJDWZ816538
ID_TYPE=disk
ID_WWN=0xb22303ed4e905002
ID_WWN_WITH_EXTENSION=0xb22303ed4e905002
MAJOR=8
MINOR=0
SUBSYSTEM=block
TAGS=:systemd:
USEC_INITIALIZED=88936

Please tell me if theres anything else that is needed to troubleshoot.

@KarstenV Thanks for opening up this issue thread and providing the info. Can you confirm that while the tail command is running and you then attempt to configure the spin down of one of the problematic Samsungs that you don’t receive the following message in the tail output:-

“Skipping hdparm settings: device not confirmed as rotational”

As from the udev output that is what I would expect. Sorry I didn’t properly specify the timing in my last post.
So you should see that message in the log every time you attempt to set the spin down as the samsung is advertising it’s AAM current value as 0. And given I have a msata device here that advertises the same by default I’ve erred on the cautious side and not accepted this as confirmation of rotational.
ie https://github.com/phillxnet/rockstor-core/commit/006928480840309bcf25bd001f2c46bb62d06991
There I concluded that:
“Real rotational devices appear to have a non zero:
ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE via udevadm.”

ie the following command shows the AAM setting of the drive sda:-

hdparm -M /dev/sda

which when returning 0 equates to:
ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE=0
in the udevadm info command, but this udev reading is set during boot and doesn’t change there after (normally).

So I would first like to see if your drives current value for AAM (Automatic Acoustic Management) persists over a power cycle and then show as non zero via the udevadm command. ie could you try first setting it to the vendor recommended value of 254 via:

hdparm -M 254 /dev/sda

and confirm the settings change via the first hdparm command ie “hdparm -M /dev/sda” then power off and on again.
Then could you state if the drive has retained it’s 254 AAC setting or if it has returned to 0.

Thanks.

I am considering if we should change to look for a non zero value for:
ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE
rather than the current value. This check is made by is_rotational in:
/opt/rockstor/src/rockstor/system/osi.py
Still looking over my drives to see if this is dependable or not.

So if restoring your Samsung drives to their vendor default setting for AAM doesn’t stick over a power cycle then we can either look to bios settings that may be adjusting this on every boot or try adjusting our key value to the vendor one.
The relevant bios settings may be:

HDD Acoustic Mode

The options for which may well be along the lines of bypass (I’m assuming this will leave it as vendor default but gave 128 on a laptop here with a samsung) quiet (lower values or 128) or performance (higher values or 254).

All a little tricky but best we err on the cautious and not execute our spin down commands on anything we can’t confirm as rotational and it turns out to be a little tricky to assess that reliably.

So in summary if you could try setting the AAM to the vendor default value and see if it persists over a power cycle and show up in udevadm and in not then look to the bios settings as they may be setting this to 0 which throws things for us. If you can’t get the drive to show a non zero udevadm reading for current AAM value (which is only setup on boot normal so a reboot will be needed) then you could try, as a last resort, changing:
ID_ATA_FEATURE_SET_AAM_CURRENT_VALUE
to
ID_ATA_FEATURE_SET_AAM_VENDOR_RECOMMENDED_VALUE
which should be at around line 647 in:
/opt/rockstor/src/rockstor/system/osi.py
followed by a reboot for the change to take effect, careful with the editing here though.
It would be interesting if that same change also works on all your other drives as well. Nice varied collection of hdd’s you have there by the way.:slight_smile:
The false positive I got for the original should still work with that change. Still looking at other drives reading re this value.

If only these Samsungs gave a rotational reading like so many other drives do. Alas.

Thanks.

1 Like

Thanks for your answer.

A lot of info to digest.

I will try to find time to try the mentioned things tomorrow.

OK.

Trying to configure one of the samsung disks, while running tail, gives the expected result:

“INFO [system.osi:759] Skipping hdparm settings: device not confirmed as rotational”

hdparm -M /dev/sda, gives:
“acoustic = 0 (128=quiet … 254=fast)”

And the setting remains the same after a reboot.

Trying to set the AAM setting to 254, seems to work:
“acoustic = 254 (128=quiet … 254=fast)”

But trying to set timeouts still reports:
“INFO [system.osi:759] Skipping hdparm settings: device not confirmed as rotational”

After a reboot, the AAM settings sticks:
“acoustic = 254 (128=quiet … 254=fast)”

And I am now able to set a disk spin down timeout :slight_smile:

Perhaps a 10 minutes spin down setting is to low, but I will test this going forward.

Thank you so much for this detective work. I would never have figured this one out myself!

My bios doesn’t have any settings for noise mangement for the disks that I could find.

And yes, I have a waried assortment of disks. I had an idea that I would get a 2TB disk from all the remaining vendors put them in the same machine in raid, and see which one died first :slight_smile:
I never got a Hitachi, so the test is not fully implemented, but I have ended up really liking the Toshiba drive, its cheap, and has been very reliable.

Oh, and by the way, the WDC disk that reports ??? in APM, reports:
" acoustic = not supported", when running hdparm -M

1 Like

@KarstenV Thanks for working through this one, this all helps with sorting out how it might be improved.
One other question:
Have your ensured that your manually applied AAM setting of 254 survives a full shutdown / power cycle as in my tests here I found some hdparm setting would revert after a power cycle but would be retained over a reboot. Hence the advice re BIOS settings that may setup the drives on each power up, so given you don’t have them that’s not going to be an option. Strange that the drive doesn’t assume it’s vendor default in that case I think.

Since is_rotational works from udevadm info and that is only updated in this setting during boot it is necessary to reboot for the udevadm info to reflect the new setting on the drive.

After your initial report I’m erring towards changing the AAM key used, as detailed in my previous post. May leave it for now until we get some more udevadm info reports of drives where is_rotational is currently blocking the settings application, as indicated by that log entry.

Thanks for the info and if you find, which I suspect you will, that your -M setting reverts over a power cycle then you are left with manually editing the AAM key is_rotational uses as per last post (this edit will need a reboot to take).

Thanks again for your testing and reporting on this one and please do let me know how that -M setting goes over a power cycle as until then there is still stuff to do. But at least we have narrowed down the issue.

Yes that is intended, I wanted to keep the table formatting simple so when there is an error reading APM level or it cleanly reports not supported then we report ??? to indicate an unknown APM state. 3 letters that seemed appropriate to reflect this. Needs a write up really but all in good time (hopefully).

I probably wasn’t clear in my post, but my -M settings did stick.

The system has been rebooted once and powered down / turned back on once (2 reboots) since i applied the “hdparm -M 254 /dev/sda (b,c,f)”.
And " hdparm -M /dev/sdX" still reports 254 for sda, sdb, sdc and sdf.

I can’t say how the setting of 0 has gotten set to the drives, it may be in their former lifes in various NAS’es.

I consider the problem fixed (for now), but will of course keep an eye on it :slight_smile:

1 Like