在一段时间不活动后自动关闭USB硬盘

我想在一段时间不活动后自动关闭USB硬盘,比如15分钟。 当然,在访问时会自动重新启动它们。 我怎样才能做到这一点? 谢谢

高清闲置实用程序应该会有所帮助

请查看下面给出的来源,仔细阅读,看看它是否有帮助:

  1. 使用以下命令使用CVS下载源代码:

    • cvs -d:pserver:anonymous@hd-idle.cvs.sourceforge.net:/cvsroot/hd-idle login
      • 要求密码时点击返回
    • cvs -z3 -d:pserver:anonymous@hd-idle.cvs.sourceforge.net:/cvsroot/hd-idle co -P hd-idle
  2. Debian系统:

    • 执行命令dpkg-buildpackage -rfakeroot
    • 并安装包运行:’dpkg -i ../hd-idle_*.deb’
  3. 用法:

     hd-idle # This will start hd-idle with the default options, # causing all SCSI (read: USB, Firewire, SCSI, ...) hard disks # to spin down after 10 minutes of inactivity 

注意:请注意,hd-idle使用/proc/diskstats来读取磁盘统计信息。 如果此文件不存在,则hd-idle将不起作用。

信息:

运行高清空闲

要运行hd-idle,请键入“hd-idle”。 这将使用默认选项启动hd-idle,导致所有SCSI(读取:USB,Firewire,SCSI,…)硬盘在10分钟不活动后停止运转。

在Debian系统上,在编辑/ etc / default / hd-idle并启用它之后,使用“/etc/init.d/hd-idle start”运行hd-idle。

请注意,hd-idle使用/ proc / diskstats来读取磁盘统计信息。 如果此文件不存在,则hd-idle将不起作用。

命令行选项

 -a  Set (partial) device name of disks for subsequent idle-time parameters (-i). This parameter is optional in the sense that there's a default entry for all [SCSI] disks which are not named otherwise by using this parameter. -i  Idle time in seconds for the currently named disk(s) (-a ) or for all disks. -l  Name of logfile (written only after a disk has spun up). Please note that this option might cause the disk which holds the logfile to spin up just because another disk had some activity. This option should not be used on systems with more than one disk except for tuning purposes. On single-disk systems, this option should not cause any additional spinups. -t  Spin-down the specified disk immediately and exit. Use only the disk name (eg sda) without /dev/ prefix -d Debug mode. This will prevent hd-idle from becoming a daemon and print debugging info to stdout/stderr -h Print brief usage information 

关于参数“-a”:

hd-idle的用户已经要求为各个磁盘设置空闲时间参数。 这很有意义,不仅因为某些[SCSI]磁盘对停止反应不佳。 最初,hd-idle对所有磁盘都有一个空闲时间。 现在可以使用参数“-a”在磁盘的设备名称上设置filter(省略/ dev /),以用于后续的空闲时间设置。

  1. 第一个“-a”选项之前的“-i”选项将设置默认空闲时间; 因此,保持了与先前版本的hd-idle的兼容性。

  2. 要在默认情况下禁用磁盘降速,然后在所选磁盘上重新启用降速,请将默认空闲时间设置为0。

例:

 hd-idle -i 0 -a sda -i 300 -a sdb -i 1200 

此示例将默认空闲时间设置为0(表示hd-idle永远不会尝试降低磁盘),然后为其设备名称中包含字符串“sda”或“sdb”的磁盘设置显式空闲时间。 停止高清闲置

使用killall hd-idle来停止hd-idle。 在Debian系统上,使用/etc/init.d/hd-idle stop

资源:

http://hd-idle.sourceforge.net/

这通常涉及硬盘驱动器端的USB-to-SATA控制器。 大多数外部USB硬盘驱动器的固件也不可配置,因此您无法始终将其设置为大小写。 可能有一些控制器可以做到这一点,但我知道没有一个是主流的USB硬盘设备。

不幸的是,如果控制器还没有让你通过自己的软件套件或类似设备对设置进行这些更改,那么就没有真正的方法可以用Linux及其基本软件来改变它。