Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[SOLVED] Unable to spin down / suspend USB-attached disk

Need help with peripherals or devices?
Post Reply
Message
Author
IcIoNViO
Posts: 6
Joined: 2021-09-03 20:06

[SOLVED] Unable to spin down / suspend USB-attached disk

#1 Post by IcIoNViO »

On my headless Debian 11 machine, my USB-attached hard disk will not sleep and keeps spinning at low speed.
I'm using a minimal Debian installation.

The hard disk is a Seagate Basic 2.5in disk attached to a USB 3.0 port:
https://www.seagate.com/products/extern ... ard-drive/

The machine is an HP t530:
https://www.parkytowers.me.uk/thin/hp/t530/

smartd is not installed so the answer posted here does not apply:
https://unix.stackexchange.com/a/476841

Code: Select all

$ cat /etc/smartd.conf
cat: /etc/smartd.conf: No such file or directory
It seems PM_RUNTIME=y needs to be set for USB saving to apply (https://wiki.gentoo.org/wiki/USB_Power_Saving).
I've checked and I can see it enabled.

Code: Select all

less /boot/config-$(uname -r) 
Looking at the answers here, I attempted to autosuspend:
https://unix.stackexchange.com/a/166601
https://stackoverflow.com/a/12675749

Code: Select all

$ lsusb
Bus 001 Device 004: ID 103c:0610 GenesysLogic USB2.1 Hub
Bus 001 Device 003: ID 8087:0025 Intel Corp. Wireless-AC 9260 Bluetooth Adapter
Bus 001 Device 002: ID 0438:7900 Advanced Micro Devices, Inc. Root Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 003: ID 0bc2:aa15 Seagate RSS LLC Basic
Bus 003 Device 002: ID 103c:8267 GenesysLogic USB3.1 Hub
Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Code: Select all

$ grep 0bc2 /sys/bus/usb/devices/*/idVendor  
/sys/bus/usb/devices/3-4.2/idVendor:0bc2
Enable autosuspend and change delay:

Code: Select all

echo "auto" > "/sys/bus/usb/devices/3-4.2/power/control"
echo "10" > "/sys/bus/usb/devices/3-4.2/power/autosuspend_delay_ms"
I waited a few minutes, but nothing happens.
The disk continues to spin.

I don't see any meaningful activity in iotop.

I realise there are options though hdparm and PowerTOP.

There are also tlp and laptop-mode-tools, but they geared for laptops (e.g. controlling display brightness) and seem excessive for what I need, which is just to spin down a hard disk.

Thanks
Last edited by IcIoNViO on 2021-09-25 21:34, edited 1 time in total.

IcIoNViO
Posts: 6
Joined: 2021-09-03 20:06

Re: Unable to spin down / suspend USB-attached disk

#2 Post by IcIoNViO »

Hi,

could someone helps with this?

Thanks

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Unable to spin down / suspend USB-attached disk

#3 Post by Aki »

IcIoNViO wrote: 2021-09-03 20:30 On my headless Debian 11 machine, my USB-attached hard disk will not sleep and keeps spinning at low speed.
I'm using a minimal Debian installation.

The hard disk is a Seagate Basic 2.5in disk attached to a USB 3.0 port:
https://www.seagate.com/products/extern ... hard-drive
Have you verified if the usb disk supports dynamic suspend ? You can try the command:

Code: Select all

hdparm -I /dev/XXX
where XXX is the device of your disk.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

LE_746F6D617A7A69
Posts: 932
Joined: 2020-05-03 14:16
Has thanked: 7 times
Been thanked: 65 times

Re: Unable to spin down / suspend USB-attached disk

#4 Post by LE_746F6D617A7A69 »

IcIoNViO wrote: 2021-09-03 20:30 smartd is not installed so the answer posted here does not apply:
... and what's the problem with installing it?

External USB drives are using SATA/USB bridge chips - some of them does not fully support the ATA/ATAPI standard, and that's why some of "advanced" functionalities are not available.

Usually, the easiest way to verify whether the SATA/USB bridge chip is conforming to the standards is to try to read the SMART report, using the smartctl utility (the -dsat option may be required for unbranded/unknown chips)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

IcIoNViO
Posts: 6
Joined: 2021-09-03 20:06

Re: Unable to spin down / suspend USB-attached disk

#5 Post by IcIoNViO »

Aki wrote: 2021-09-08 14:41
IcIoNViO wrote: 2021-09-03 20:30 On my headless Debian 11 machine, my USB-attached hard disk will not sleep and keeps spinning at low speed.
I'm using a minimal Debian installation.

The hard disk is a Seagate Basic 2.5in disk attached to a USB 3.0 port:
https://www.seagate.com/products/extern ... hard-drive
Have you verified if the usb disk supports dynamic suspend ? You can try the command:

Code: Select all

hdparm -I /dev/XXX
where XXX is the device of your disk.
Thanks.

hdparm reports the following, which seems inconclusive?

Code: Select all

$ sudo hdparm -I /dev/sdb

/dev/sdb:

ATA device, with non-removable media
Standards:
        Likely used: 1
Configuration:
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        --
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes
        cache/buffer size  = unknown
Capabilities:
        IORDY not likely
        Cannot perform double-word IO
        R/W multiple sector transfer: not supported
        DMA: not supported
        PIO: pio0
Last edited by IcIoNViO on 2021-09-08 22:39, edited 1 time in total.

IcIoNViO
Posts: 6
Joined: 2021-09-03 20:06

Re: Unable to spin down / suspend USB-attached disk

#6 Post by IcIoNViO »

LE_746F6D617A7A69 wrote: 2021-09-08 20:52
IcIoNViO wrote: 2021-09-03 20:30 smartd is not installed so the answer posted here does not apply:
... and what's the problem with installing it?

External USB drives are using SATA/USB bridge chips - some of them does not fully support the ATA/ATAPI standard, and that's why some of "advanced" functionalities are not available.

Usually, the easiest way to verify whether the SATA/USB bridge chip is conforming to the standards is to try to read the SMART report, using the smartctl utility (the -dsat option may be required for unbranded/unknown chips)
Here's the output, which doesn't seem very helpful.
Should I try connecting to a different USB port?

Code: Select all

$ sudo smartctl /dev/sdb -d sat
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-8-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

ATA device successfully opened

Use 'smartctl -a' (or '-x') to print SMART (and more) information

Code: Select all

$ sudo smartctl /dev/sdb -a -T verypermissive
smartctl 7.2 2020-12-30 r5155 [x86_64-linux-5.10.0-8-amd64] (local build)
Copyright (C) 2002-20, Bruce Allen, Christian Franke, www.smartmontools.org

Read Device Identity failed: scsi error unsupported field in scsi command

=== START OF INFORMATION SECTION ===
Device Model:     [No Information Found]
Serial Number:    [No Information Found]
Firmware Version: [No Information Found]
Device is:        Not in smartctl database [for details use: -P showall]
ATA Version is:   [No Information Found]
Local Time is:    Wed Sep  8 23:37:42 2021 BST
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 82-83 don't show if SMART supported.
SMART support is: Ambiguous - ATA IDENTIFY DEVICE words 85-87 don't show if SMART is enabled.
                  Checking to be sure by trying SMART RETURN STATUS command.
SMART support is: Unknown - Try option -s with argument 'on' to enable it.
Read SMART Data failed: scsi error unsupported field in scsi command

=== START OF READ SMART DATA SECTION ===
SMART Status command failed: scsi error unsupported field in scsi command
SMART overall-health self-assessment test result: UNKNOWN!
SMART Status, Attributes and Thresholds cannot be read.

Read SMART Error Log failed: scsi error unsupported field in scsi command

Read SMART Self-test Log failed: scsi error unsupported field in scsi command

Selective Self-tests/Logging not supported

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Unable to spin down / suspend USB-attached disk

#7 Post by ticojohn »

I am NOT an expert, by any means, but I wonder if your drive is even working correctly. When I check an external USB drive using hdparm I get the following

Code: Select all

/dev/sdh:

ATA device, with non-removable media
	Model Number:       WDC WD3200BMVV-11SXZS1                  
	Serial Number:      WD-WXL1E61PHWK4
	Firmware Revision:  01.01A01
	Transport:          Serial, SATA 1.0a, SATA II Extensions, SATA Rev 2.5, SATA Rev 2.6
Standards:
	Supported: 8 7 6 5 
	Likely used: 8
Configuration:
	Logical		max	current
	cylinders	16383	16383
	heads		16	16
	sectors/track	63	63
	--
	CHS current addressable sectors:    16514064
	LBA    user addressable sectors:   268435455
	LBA48  user addressable sectors:   625142448
	Logical  Sector size:                   512 bytes
	Physical Sector size:                  4096 bytes
	Logical Sector-0 offset:                  0 bytes
	device size with M = 1024*1024:      305245 MBytes
	device size with M = 1000*1000:      320072 MBytes (320 GB)
	cache/buffer size  = 8192 KBytes
	Nominal Media Rotation Rate: 5400
plus a whole lot more.
I am not irrational, I'm just quantum probabilistic.

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Unable to spin down / suspend USB-attached disk

#8 Post by Aki »

Hello,
IcIoNViO wrote: 2021-09-08 22:36 hdparm reports the following, which seems inconclusive?

Code: Select all

$ sudo hdparm -I /dev/sdb
/dev/sdb:
ATA device, with non-removable media
Standards:
        Likely used: 1
Configuration:
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        --
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes
        cache/buffer size  = unknown
Capabilities:
        IORDY not likely
        Cannot perform double-word IO
        R/W multiple sector transfer: not supported
        DMA: not supported
        PIO: pio0
As user ticojohn pointed out, it looks like the disk is not correctly detected and a lot of information are missing in the output. Is the disk correctly connected and powered ? Can you give more information about your hardware configuration ? You could use the following commands with the external drive connected:

Code: Select all

script log.txt
su -c "apt install inxi"
inxi -v6 
exit
The output will be in log.txt file.

EDIT: for test purposes, I obtained your same output querying the empty cdrom drive:

Code: Select all

# hdparm -I /dev/cdrom 

/dev/cdrom:

ATA device, with non-removable media
Standards:
        Likely used: 1
Configuration:
        Logical         max     current
        cylinders       0       0
        heads           0       0
        sectors/track   0       0
        --
        Logical/Physical Sector size:           512 bytes
        device size with M = 1024*1024:           0 MBytes
        device size with M = 1000*1000:           0 MBytes 
        cache/buffer size  = unknown
Capabilities:
        IORDY not likely
        Cannot perform double-word IO
        R/W multiple sector transfer: not supported
        DMA: not supported
        PIO: pio0 
You have probably queried the wrong device. Please send the information about hardware configuration anyway.
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

IcIoNViO
Posts: 6
Joined: 2021-09-03 20:06

Re: Unable to spin down / suspend USB-attached disk

#9 Post by IcIoNViO »

Thanks for your replies.

After further investigation, it turns out that for a number of Seagate enclosures, Linux disables SAT transfers when running in UAS mode.
That's true in my case:

Code: Select all

$ lsusb -t
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 4: Dev 2, If 0, Class=Hub, Driver=hub/2p, 5000M
        |__ Port 2: Dev 3, If 0, Class=Mass Storage, Driver=uas, 5000M
There is more information here, for anyone else looking, including possible fixes:
https://www.smartmontools.org/wiki/SAT-with-UAS-Linux
https://www.smartmontools.org/ticket/971
https://www.smartmontools.org/wiki/Supp ... SB-Devices
https://askubuntu.com/questions/637450/ ... hard-drive

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: Unable to spin down / suspend USB-attached disk

#10 Post by Aki »

Hello,
IcIoNViO wrote: 2021-09-09 08:16 After further investigation, it turns out that for a number of Seagate enclosures, Linux disables SAT transfers when running in UAS mode. That's true in my case
Are you planning to reactivate (even if temporarily) the pass-through commands for the SAT (SCSI/ATA Translation, ANSI INCITS 431-2007) standard for your Seagate drive as shown in workaround B [1] ? If yes, you could try to query the disk and try to activate the suspend functionalities of the drive (if any).

[1] https://www.smartmontools.org/wiki/SAT- ... orkarounds
[2] https://www.smartmontools.org/wiki/USB
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

LE_746F6D617A7A69
Posts: 932
Joined: 2020-05-03 14:16
Has thanked: 7 times
Been thanked: 65 times

Re: Unable to spin down / suspend USB-attached disk

#11 Post by LE_746F6D617A7A69 »

If it's not already too late, I would suggest to backup Your data on some other drive - experimenting with broken SATA/USB bridge chips can lead to data loss or even to damaging the hardware ... (or firmware configuration)
The probability is rather low, but sometimes sh.it happens :)
Bill Gates: "(...) In my case, I went to the garbage cans at the Computer Science Center and I fished out listings of their operating system."
The_full_story and Nothing_have_changed

IcIoNViO
Posts: 6
Joined: 2021-09-03 20:06

Re: Unable to spin down / suspend USB-attached disk

#12 Post by IcIoNViO »

Thanks for your replies.

After some experimenting, I managed to communicate with the drive.
Also, I did so without disabling UAS.

The instructions are here:
https://www.smartmontools.org/wiki/SAT- ... nd-unset-t

and the important bit is to omit the "u" at the end.
This disables NO_ATA_1X flag, but keeps the UAS functionality.

I did try to set the drive to autosuspend, as described here:
https://stackoverflow.com/questions/470 ... 9#12675749
https://unix.stackexchange.com/question ... 601#166601

But that didn't work.

The only thing that work was to set

Code: Select all

hdparm -B 127 /dev/sdb
As described here:
https://wiki.archlinux.org/title/hdparm

To make this persist a reboot, I edited /etc/hdparm.conf:

Code: Select all

/dev/sdb {
apm = 127
}
Thanks for your help

Aki
Global Moderator
Global Moderator
Posts: 2823
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 69 times
Been thanked: 385 times

Re: [SOLVED] Unable to spin down / suspend USB-attached disk

#13 Post by Aki »

Hello IcIoNViO,

Thank you for the update: I'm happy you sorted it out.

As user LE_746F6D617A7A69 pointed out, it is better to adopt a cautionary approach with "quirks", but in your case it seems to work.

I did the same for a USB3 HDD disk enclosure with ASM1053e. The kernel patch that disabled SAT ATA PASS-THROUGH (in UAS mode) for the ASM1051 chipset is about 7 years old [1] and I seem to understand that some/most of ASM1053 chipset could work correctly anyway, so I gave it a try.

[1] https://lore.kernel.org/lkml/2014100723 ... ation.org/
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

Scar_UY
Posts: 1
Joined: 2021-09-30 23:09

Re: [SOLVED] Unable to spin down / suspend USB-attached disk

#14 Post by Scar_UY »

Hello IcIoNViO,

And Thank you!

I've been tinkering with linux on my own for the best part of the last 20 years, and while it usually takes me a ridiculous amount of time when I run into weird problems like the one you had, you clearly are far more proficient with linux than me for the way you understood, presented, and solved your problem, and what makes you an awesome person is that you posted everything here for others to find, like me, I ran in to the exact same problem, and the link you shared worked like magic.

More often than not, even after weeks googling and trying things, breaking and reinstalling and what not, I'm forced to abandon and find another way to do things when I run in to this kind of problems because my lack of deep (or sometimes even basic) knowledge of the inner workings of linux, this time is not one of those.

Sorry about the rant, I just wanted to give you some context so you understand how grateful I am for your contribution here.

Thank you!

Post Reply