Power saving mode USB 3.0

Hello, everyone.
I was wondering is there a tool to manage Opensuse power modes?

Because I have a fallowing problem.
From time to time, my external HDD is suddenly disconnects and connects again.
I was reading here:
http://www.tomshardware.com/answers/id-1744364/hard-drive-disconnecting-reconnecting.html

That on Windows it could be solved by tweaking power supply of USB ports.
Is there something similar on Linux?

Or maybe I’m going in the wrong direction?

To prevent USB autosuspend completely, you can add ‘usbcore.autosuspend=-1’ to GRUB. Alternatively, create a file in /etc/modprobe.d/ directory eg 20-usbsuspend.conf with the following entry

options usbcore autosuspend=-1

Particular devices can be configured using a udev rule. For example, for a USB device ‘0xxx:0yyy’ you could do

ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="0xxx", ATR{idProduct}=="0xyyy", ATTR{Power/Control}="on"

References
https://wiki.archlinux.org/index.php/Power_management#USB_autosuspend
https://www.kernel.org/doc/Documentation/usb/power-management.txt

power/control

  This file contains one of two words: "on" or "auto".
  You can write those words to the file to change the
  device's setting.
  "on" means that the device should be resumed and
  autosuspend is not allowed.  (Of course, system
  suspends are still allowed.)
  "auto" is the normal state in which the kernel is
  allowed to autosuspend and autoresume the device.
  (In kernels up to 2.6.32, you could also specify
  "suspend", meaning that the device should remain
  suspended and autoresume was not allowed.  This
  setting is no longer supported.)

power/autosuspend_delay_ms

  This file contains an integer value, which is the
  number of milliseconds the device should remain idle
  before the kernel will autosuspend it (the idle-delay
  time).  The default is 2000.  0 means to autosuspend
  as soon as the device becomes idle, and negative
  values mean never to autosuspend.  You can write a
  number to the file to change the autosuspend
  idle-delay time.

Writing “-1” to power/autosuspend_delay_ms and writing “on” to
power/control do essentially the same thing – they both prevent the
device from being autosuspended. Yes, this is a redundancy in the
API.

Thank you for your help.
I will test this settings and post results.

But, there are some way to tweak system wide power settings?
Like CPU governor, or like-Windows performance mode, balanced, power-saver?

Okay, adding:


options usbcore autosuspend=-1

to:


 /etc/modprobe.d/ directory eg 20-usbsuspend.conf 

is not working, HDD is still disconnecting…

I will test hardware.

Did you reload usbcore after making those changes?

I reloaded laptop, its okay?

But, anyway, its seems that problem is case of my HDD.

Yes, rebooting achieves the same.

But, anyway, its seems that problem is case of my HDD.

This may well be the case. I think many external HDD devices behave this way. I have read of a Windows utility called NoSleepHD which writes an empty text file periodically to prevent HDD devices from going into sleep mode. The same could be achieved in Linux via a suitable cron job, or perhaps hdparm will work for you

https://wiki.archlinux.org/index.php/Hdparm#Power_management_configuration

Not sure and no time to refresh my memory at the moment, but I think that can be turned off with smartctl?

I know at one time most manufacturers had a way for tweaking the HD settings with tools.