HomeHow ToHow to Automatically Spin Down or Sleep HDD on Raspberry Pi

How to Automatically Spin Down or Sleep HDD on Raspberry Pi

It is probably not a great idea to let your HDD spin forever on a server that is always on. Whether you are using that for Network Storage, MiniDLNA, Transmission, or anything similar, there is always a chance that your HDD will be sitting idle but still spinning almost 50% of the time.

We have tried many of the methods we found on the internet, but none worked as flawlessly as the one we will use in this tutorial.

We tested this method on Raspberry Pi 4 & Raspberry Pi 2B running Raspberry Pi OS based on Debian 12 Bookworm. But it will work on any Debian-based Linux where Gnome Disk Utility is installed, be it Ubuntu, Linux Mint, MX Linux, Kali Linux, etc.

How to Setup Automatic Spin Down or Sleep HDD on Raspberry Pi using Gnome Disk Utility

  1. Open the terminal and install Gnome Disk Utility using the command:
sudo apt install gnome-disk-utility
Install Gnome Disk Utility
  1. Open Gnome Disk Utility using the command:
sudo gnome-disks
Open Gnome Disk Utility
  1. Once Gnome Disk Utility is opened, Select the drive you want to spin down automatically.
Gnome Disk Utility Home
  1. Note down the Device path for later use. In our case, it was /dev/sdb
  2. Press the vertical three-dot button on the top right section of the window.
Gnome Disk Utility Menu
  1. Select Drive Settings.
  2. Enable the Apply Standby Timeout Settings and select the time after which the HDD should spin down after idle. Be very careful while choosing this interval; a small interval can cause the HDD to wake up frequently and cause additional wear & on the other hand, setting a higher interval may cause the HDD never to spin down. In our case, 60 Minutes was the sweet spot. Decide yours accordingly.
Gnome Disk Utility - Standby Settings
  1. Switch to the APM TabEnable the Apply Advanced Power Management Settings. Set this to 255. It will disable APM on your drive. We are doing this so that the default APM settings on your drive will not cause any conflict with the Standby Timeout we set in the earlier step. 
Gnome Disk Utility - Apm Settings
  1. Press the OK Button to save the settings

Now, to check whether the settings we have just applied show results in real life, proceed to the next section. 

How to Check HDD Active and Standby Status using hdparm on Raspberry Pi

  1. Open the terminal and install hdparm using the following command:
sudo apt install hdparm
Install Hdparm
  1. Type the following command in the terminal and replace [path] with the path we noted in step 4 in the earlier section:
sudo hdparm -C [path]
  1. It will show the status of the HDD. The drive state is showing as active since it’s just been a few minutes. 
Check Active Status Hdparm
  1. Repeat the same command after the Standby Timeout you set, and it will show that your Hard Disk Drive is now in standby mode. 
Check Standby Status Hdparm

Why is My HDD Not Spinning Down, Sleeping, or Waking Up Frequently on Raspberry Pi?

In this case, you will need to check which processes are accessing your HDD and preventing it from spinning down and what is making it wake up more frequently. We will give you pointers on where to start. 

  • If you are using Docker containers stored on your HDD or the Docker containers are using this drive mounted as a volume, you need to turn off that first or shift to other drives. 
  • If you are using Transmission for downloading torrents, ensure that “scrape-paused-torrents-enabled” is set to false in the settings.json file.
  • If you are accessing the SMART data of this HDD via smartctl or any other utility, it may also sometimes interfere with the Spin Down.  
  • If you are using miniDLNA or a similar service, ensure that you have turned off the automatic discovery of new files in the media directory by using inotify=no in minidlna.conf file. 
  • You can try using the following command to check whether any open files are mounted on the path using your HDD. Here, replace [mount-path] with the path to access HDD files:
lsof | grep [mount-path]

How do you spin down the HDD using hdparm on Raspberry Pi? 

  1. To enable standby timeout using hdparm, type the following command:
sudo hdparm -S [value] [path]

* Values from 1 to 240 are in multiples of 5 seconds, which means 1 = 5 Seconds and 240 = 20 Minutes
* Values from 241 to 251 are in multiples of 30 minutes, which means 1 = 30 Minutes and 240 = 5 Hours & 30 Minutes
* 252 = 21 Minutes
* Other values are sometimes vendor-defined and outside the scope of this article. 

  1. Now, to disable the APM, type the following command:
sudo hdparm -B 255 [path]

Why are we not using hdparm to Spin Down or Sleep HDD on Raspberry Pi?

While hdparm is also easy, the changes do not persist on reboot. To make changes persist on a reboot, you must either add it to rc.local or create a systemd service to execute those commands on boot. 

We also tried that but got nowhere to get it working. Although the commands were executing okay as per the logs, we could not verify it using the following commands:

sudo hdparm -S [path]
sudo hdparm -B [path]

Both of these commands were returning the default settings of the drive. Hence, it was easier to proceed with Gnome Disk Utility. 

Also read: 14 Best SSH Clients for Windows & Mac


Protect Your Online Privacy With Surfshark
[The VPN that we use here at Tech Arrival]


Why are we not using hd-idle for Spinning Down the HDD on Raspberry Pi?

We have tried hd-idle as well, but unfortunately, we were getting errors executing the command, so we skipped it for a better solution. 


“As an Amazon Associate & Affiliate Partners of several other brands we earn from qualifying purchases.” [Read More Here]


Leave a Comment

Please enter your comment!
Please enter your name here

By submitting the above comment form, you agree to our Privacy Policy and agree with the storage and handling of your data by this website.


Stay Connected

Subscribe to our Newsletter

Stay updated with all the latest news, offers and special announcements.

By signing up, you agree to our Privacy Policy and agree with the storage and handling of your data by this website.

Latest Posts

What is The Highest Snap Score?

There's a lot of hype surrounding Snap scores. It measures your in-app activities and shows how active you are on the platform. Although it...

Best Software Sales Strategies – The Complete Guide

Software sales in today's market are highly competitive due to market saturation. Therefore, sales will require a strategic and customer-centric approach to stand out...

Vidnoz AI Video Generator Review: Best Free Video Generator with Realistic Avatars

Nowadays, people worldwide are spending more time watching video content than reading. Hence, it becomes essential for businesses to keep up with the trend...

How to Optimize Your Digital Camera for Photography

If you are a professional photographer or love photography, you need the best camera for quality pictures and videos. The digital camera provides all...

7 Ways to Take Advantage of Customer Data

In the modern digital era, escaping data seems virtually impossible. It appears as though data is ubiquitous, and its volume is expanding at an...

All Time Favorites

11 Best WiFi Hacking Apps for Android (2023)

Today, almost anywhere we go, we are surrounded by tons of WiFi Networks, whether at our homes, hotels, workplaces, or even public places like...

17 Best Illegal Android Apps Not on Play Store (2023)

Google Play Store has the most extensive collection of apps for Android. Almost everyone downloads apps from the Play Store. However, certain genuinely excellent...

15 Best Game Hacking Apps for Android (2023)

Are you a mobile gamer? If you are, then you've come to the right place. This post will tell you about the Best Game...

How to Download Torrent Files with IDM (Torrent to IDM)

Hey guys, you may all have heard about different ways to download torrent files. And some of you may also have downloaded them using...

11 Best Download Managers for Windows

The Internet is a vast resource of a lot of things which includes music, videos, movies and a lot of other things. The ability...