As most are aware of, with Ubuntu 12.04 LTS (Precise Pangolin) a tool called ‘hdparm’ is installed and enabled by default. It’s a very handy tool that lets the OS to control various power management features that comes with SATA/IDE drives (including few SCSI related options) in order to save power.
Now I personally like this tool and the fact that it’s enabled by default because one of the things that it does is spinning downing the HDD and specially because I use my notebook on wooden table, my 320 GB SATA which spins about 7200RPM does make some noises. So after a certain interval, if there’s no disk activity, Ubuntu 12.04 spins it down and it reduces the noise, a lot. It also comes in handy while reading an ebook as well.
But one of the disadvantageous of it is that, once the HDD is spinned down, if you try to open a file on your HDD you’ll see a small delay. Now the never hard disk drivers have an extremely fast spin up times so the delay is minimal, yet, from your perspective, if you think Ubuntu 12.04 spins down your hard disk too frequently then you can easily disable it or change the interval to a higher value with ease.
However, please bear in mind that, spinning down a HDD within a reasonably longer interval is recommended by the experts as it helps to extend the lifetime of your HDD. So you’d perhaps should consider entering a higher spin-down time value rather than disabling it. Then again, spinning up and down it quite frequently can shorten the lifetime as well.
Anyhow, below is how you can do it.
Step 1: Since taking precautions is a good thing ;-), let’s backup the file (a script) that controls this behavior in Ubuntu 12.04 into your ‘Home’ folder. For that, use the below command in your Terminal window.
cp /etc/apm/event.d/20hdparm ~
Step 2: Then enter the below command to edit this file.
gksudo gedit /etc/apm/event.d/20hdparm
This should open the file in your text editor. Once it’s opened, press ‘Ctrl’ + ‘f’ keys or just search for the below term using the text editor’s search function (you can scroll down and find it too).
Step 3: Now all you gotta do is change the number ’18’ into a value that you like your HDD to wait before spinning down. However, the number does not denote the actual ‘waiting seconds’, as explained in the paragraph above it, you have to multiple it by ‘5’ to get the seconds.
For instance, the default value is ’18’, which is ’90’ seconds (18*5) or 1.5 minutes. If you want the HDD to wait about 3 minutes before spinning down, then we first have to convert the minutes into seconds (by multiplying it 60, of course) and then divide it by 5, so the final value that you should enter for waiting 3 minutes is: ’36’.
If you want, you can use the below equation for the calculation :D.
wanted-hdd-spin-down-time-in-minutes * 60
So, after you’ve calculated it, replace that with ’18’ and once that’s done, make sure to click on the ‘Save’ button (as shown below) and then close the text editor. If it didn’t work at first, then reboot your computer and it should work after that.
For disabling it completely …
If you want, you can completely disable the HDD spinning downing by replacing ’18’ with ‘0’ (zero).
That’s it, enjoy!.