Spin Down and Manage Hard Drive Power on Raspberry Pi - sleep hdd hd-idle

Spin Down and Manage Hard Drive Power on Raspberry Pi - sleep hdd hd-idle

This is an example how you to set the hard drive into a standby or hibernate mode after a defined time. This saves power and protects the hard drive in continuous or server use.

Requirements:

  1. As a first step we need to update the package lists of Raspbian. We further need to install hdparm.

    sudo apt-get update && sudo apt-get -y install hdparm
  2. To figure the name under which the hard drive is mounted in the system we need to use the following command. In this example, it is /dev/sda

    sudo fdisk -l

    raspberry pi hdd standy spin down- hd-idle

  3. We check the current power mode status. In case it returns the status unknown, it is impossible to set the hard drive to a standby mode. Your HDD does not support spin down/hd-idle.

    sudo hdparm -C /dev/sda

    raspberry-pi-hdd-standy-2

    “-C shows the current “Power-Mode-Status” of an IDE hard drive. The return value can have the following states:

    • “unknown” - The hard drive does not support the command
    • “active”/“idle” - Standard operation
    • “standby” - Low power mode, the hard drive does not spin or even sleeps completely

    The options -S, -y, -Y and -Z can be used to change the IDE power mode. wiki.debianforum.de

  4. We use the parameter -y to set the hard drive to the standby mode. The hard drive should now be completely quiet. The command sudo hdparm -C /dev/sda can be used to check if the hard drive is in standy mode. As soon as the hard drive is accessed it should start to spin again.

    sudo hdparm -y /dev/sda

    raspberry-pi-hdd-standy-3

  5. Now we need the UUID of the hard drive. Type the following command into the console and note the UUID of the hard drive.

    sudo blkid

    raspberry-pi-hdd-standy-4

  6. Open the hdparm config file with the text editor Nano.

    sudo nano /etc/hdparm.conf

    Replace yourUUID with the previously noted UUID and add the text shown below at the end of the file. Exit the Nano text editor afterwards with Strg+x (Win) ctrl+x (Mac) and confirm the changes with y or j (depending on your language settings).

    
    /dev/disk/by-uuid/yourUUID {
      spindown_time = 240
    }

    raspberry-pi-hdd-standy-5

    The number behind spindown_time tells after what time the hard drive will be set to its standby mode. Choose the time not to short as a continuous start-up of the hard drive will harm its motor and mechanics.

    0 = Standy activated 60 = 5Min (60*5Sec=300Sec=5Min) 240 = 20Min (240*5Sec=1200Sec=20Min) From 240 the calcuation changes 241 = 30Min (1*30Min) 242 = 60Min (2*30Min)

  7. Now restart the system with the command shown below. After that the hard drive will automatically go into standby mode after the time you have set.

    sudo reboot

Similar Posts