Question

I have a very annoying problem with my notebook. I have an internal SSD drive with system and an external old HDD drive (in optical disk bay) for large games mostly. The problem is, that the HDD drive keeps spinning down, after every 10 seconds of inactivity. This happens no matter what - tried everything (windows power management included), without luck - disk totally ignores all the settings every time. This makes unbearable lags when trying to access new data after spindown, thing that makes most games unplayable. These constant spinups/downs also shortens disk life.

So after trying some methods i decided to write a C# application, which will simply count lines in a random file from the list below - located on external drive, by reading file line-by-line. Its a winforms app, but method keepSpinning is called in a separated thread.

    List<string> filesToSpin = new List<string>();
    public Form1()
    {
        filesToSpin.Add(@"D:\book\Generic_User_Guide.pdf");
        filesToSpin.Add(@"D:\book\Quick Guide.pdf");
        filesToSpin.Add(@"D:\book\pck_ls.pdf");
        filesToSpin.Add(@"D:\book\guide_amd64.pdf");
    }

    private void keepSpinning()
    {
        while(someKeepAliveVariable)
        {
            Random r = new Random();
            int index = r.Next(filesToSpin.Count);
            string spinThis = filesToSpin[index];
            int counter = 0;
            string line;
            Console.WriteLine("Reading file: " + spinThis);
            System.IO.StreamReader file =
                new System.IO.StreamReader(spinThis);
            while ((line = file.ReadLine()) != null)
            {
                counter++;
            }
            file.Close();
            Console.WriteLine("Read {0} lines.", counter.ToString());
            Thread.Sleep(2000);
        }
    }

Well. Surprisingly, this also doesn't work. It works for a while, but then it keeps printing the info of read file but disk stops. I guess the drive is caching those files somehow. Also lines-counting method is quite CPU intensive. Any advice on code changes would be helpful, also looking forward for any other solutions.

Was it helpful?

Solution 2

First of all, thank you all for all the responses. I tried some different approach and finally, after a year of struggling found a solution. Sorry for not giving the HDD name. Here it is: WD750BPVT. I also didn't mention about second problem: the drive was clicking when idle, few times before disk spindown. I'll answer my own question to save hair on someone's head. The problem was not easy to track.

Writing a C# app was quite good approach, but it has its drawbacks. When I changed the code to write data instead of read, it was quite a success (none spindowns) but the drive was constantly clicking when idle (each 2-3 secs).

Someone would say, that the HDD is ready to die because of clicking sound and I should backup my data while getting ready to trash the device. However I found an explanation. The reason of all these things is a feature, designed to save some power and disk lifetime (sic!). This feature, or actually two of them are:

Automatic Acoustic Management (AAM)
Advanced Power Management (APM)

Power management regulates spindowns and acoustic management is responsible for head parking (clicking noise). All you have to do is simply disable both of these. You can do this for example in CrystalDiskInfo: functions -> advanced -> AAM/APM control, select the drive you want and click both disable buttons. Problem solved until reboot. Its not permanent, so adding CrystalDiskInfo to startup is a good move.

This solution might also work for other devices / manufacturers, so if you have similar problem I strongly suggest to try that out.

OTHER TIPS

Write to a file on the disk instead of reading. Remember to clear those files out every once in a while to.

Plus on a side note, that HDD doesn't sound good.

It probably fails because the OS reads a large buffer of the file and puts it in cache.

You can:

  • write to a file rather than read, flushing the file each time.
  • use FILE_FLAG_NO_BUFFERING (then you need to use the win32 API CreateFile).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top