batch scripts for turning off hard drives from windows

Silencing hard drives, optical drives and other storage devices

Moderators: NeilBlanchard, Ralf Hutter, sthayashi, Lawrence Lee

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

batch scripts for turning off hard drives from windows

Post by zsero » Mon Nov 30, 2009 12:05 am

Using HDDScan-s command line builder and mountvol, I figured out the following two commands to unmount a hard drive (it only works with additional drives, like D:\), and spins it down, then mount it back later. If I don't unmount it first, sooner or later there is always a windows program in the background which queries it, but unmounting takes care about that.

Here is the code, if you are interested.
spindown.bat

Code: Select all

mountvol d:\ /d
"HDDScan.exe" "\\?\ide#diskst31000528as____________________________cc44____#5&1c80af87&0&2.0.0#{53f56307-b6bf-11d0-94f2-00a0c91efb8b}" -Z
spinup.bat

Code: Select all

mountvol d:\ \\?\Volume{6708118c-cb14-11de-959d-806e6f6e6963}\
For the HDDScan part you can use the built in command line builder, for the mountvol, you can type mountvol d:\ /L to get the code.

Now my only problem is that using SpeenFan it triggers SMART values, which spins up the drive even if the partition is unmounted. I need to solve that, because except for that, this way if I ever buy a SSD I could just install OS to the SSD and only turn on those hard drives I need to use, meaning many TB's storage without any noise, when not needed.

whiic
Posts: 575
Joined: Wed Sep 06, 2006 11:48 pm
Location: Finland

Post by whiic » Mon Nov 30, 2009 8:26 am

Nice short tutorial.

"Now my only problem is that using SpeenFan it triggers SMART values, which spins up the drive even if the partition is unmounted. I need to solve that"

That's the easy part. Just disable temperature monitoring of selected hard drives. Temperature monitoring of HDDs is performed by reading SMART data. HDD's internal SMART logics read temperature sensor continuosly, but the system can only read the temperature data by requesting all SMART data... and some of that is written on the platters, requiring HDD to spin up on temperature polling of SpeedFan.

By default, SpeedFan polls all HDDs at 1 minute interval. Just click on "Configure", then "Temperatures", and then untick all HDDs you might occasionally want to spin down, and confirm all made changes by clicking "OK".

Constant HDD temperature monitoring isn't required after initial monitoring of temperatures after installation of new drive to the system. Even then, I don't bother to check the temperatures unless I've made something out of the ordinary (sandwiching, enclosing, wrapping in sound-insulation (which unfortunately usually insulates heat as well), or with systems with ultra-low-airflow.

jon1003
Posts: 1
Joined: Tue Dec 01, 2009 3:42 am
Location: USA

Post by jon1003 » Tue Dec 01, 2009 3:48 am

This is great, I can't believe there aren't more replies to this. Can this also work with a raid 5 of 3 disks? It's so annoying having lots of storage being spun up all the time on the whim of background tasks in windows for no good reason.

Haych
Posts: 106
Joined: Sat Oct 17, 2009 11:16 am
Location: Lancashire, UK

Post by Haych » Tue Dec 01, 2009 7:54 am

Holy flirking schnit, it works! zsero, you're a star as far as I'm concerned.

I've been slightly infuriated that Vista keeps spinning up my data drive when it should be idle, but haven't known of any way to keep it shut down. It took me a little bit of googling to figure out what mountvol is and how to access it, but once I'd got that done, it worked like a charm.

I'm guessing that my data drive may still be using power, but it'll be minimal, so I'll be saving on my electric now, as well.

One question. Do I need to have HDDScan on my drive for this to work, or can I delete it now?

My most sincere thanks to you, sir :D

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

Post by zsero » Tue Dec 01, 2009 11:03 pm

It's good to hear that it works!

Bad news for me is that it seems that my drives doesn't fully support the spindown feature (Seagate 7200.12), which means that when they spin up they will work, but start spinning down after 10 seconds of inactivity. A reboot solves the problem.

A good news for you might be that I found a more polished solution, called HotSwap!. It's a freeware program from Japan, which does it all, and it has a neat clickable interface on the system tray. It supports spindown, unmounting, everything.
http://mt-naka.com/hotswap/index_enu.htm

For HDDScan, you can put it in any folder, it doesn't need to be on the drive, and as far as I know it's portable (doesn't need to be installed, you can start it from any folder). But I would suggest for everyone to try out HotSwap! if it works on your system then it's a really cool one-click solution with no need for HDDScan or mountvol batch files.

EDIT: It seems that Windows 7's built in "turn off hard drives after ... min" works well on my drives, it must use a different command than what HDDScan and HotSwap! uses to turn off the drive.
Now my batch files are simply mountvol down - wait 1 minute - mountvol up, without the HDDScan part.

EDIT #2: Turning off HDD checkboxes doesn't work for me in SpeedFan, but I have found out that starting it with /NOSMARTSCAN option compeletely disables all SMART functions, hence it works very well for hard drives in a spindown.

Boris Bilinsky
Posts: 20
Joined: Fri Oct 31, 2008 1:42 am
Location: Sweden

Post by Boris Bilinsky » Sat Jan 02, 2010 3:07 pm

What about mac os x? It would really be great with individual spindown settings on each disk. I've searched a bit and this is what I've found so far (applescript):

Code: Select all

on run {input, parameters}
	
	set vol to "example"
	tell application "Finder"
		if (exists disk vol) then
			do shell script "diskutil unmount /Volumes/" & vol
		else
			set device to do shell script "diskutil list |grep " & vol & " |awk '{print $6}'"
			do shell script "diskutil mount /dev/" & device
		end if
	end tell
	
	return input
end run
from http://forums.macnn.com/90/mac-os-x/396 ... -possible/

But an automatic shell script would be cooler, maybe something like this:
http://forums.freebsd.org/showthread.ph ... r#post5891

If it's possible to tweak for os x usage.

syrian_gamer
Posts: 74
Joined: Wed Jan 21, 2009 10:58 am
Location: Montreal

Post by syrian_gamer » Sun Jan 24, 2010 7:56 am

Wow, I have been looking for years to find a way to spin down my hard drive when im not using it! I can finally buy a SSD and not worry about space or anything, since half the time im just browsing the net, i dont really need all my other data.

Yes this post was useless but i still wanted to say thanks :D

NoiseFreeGuy
Posts: 332
Joined: Mon May 15, 2006 7:16 pm
Location: Guelph, Canada

Post by NoiseFreeGuy » Tue Apr 27, 2010 5:30 pm

syrian_gamer wrote:Wow, I have been looking for years to find a way to spin down my hard drive when im not using it! ...
I'm not sure I understand the need for this at this point in history?

I have a fairly old MB, circa 2005.
With the MB and WinXP and a BIOS setting, my HD powers down at a user selected time interval (mine is about 20 minutes I think.)

Am I missing something?

syrian_gamer
Posts: 74
Joined: Wed Jan 21, 2009 10:58 am
Location: Montreal

Post by syrian_gamer » Sat May 22, 2010 7:04 am

NoiseFreeGuy wrote:
syrian_gamer wrote:Wow, I have been looking for years to find a way to spin down my hard drive when im not using it! ...
I'm not sure I understand the need for this at this point in history?

I have a fairly old MB, circa 2005.
With the MB and WinXP and a BIOS setting, my HD powers down at a user selected time interval (mine is about 20 minutes I think.)

Am I missing something?
Yes, the problem is that something always spins it up, whether its explorer, or an AV. So essentially it wont power down and STAY powered down for very long.

On a side note, anybody having issues with this software? Specifically im having an issue where i spin down a drive and unmount, and after remounting it it keeps spinning down. I open my documents, it spins up, loads my documents, then spins right down again. Very annoying, very bad for the drive, very time consuming as well. any1 experience this?

nwbdan
Posts: 28
Joined: Tue Jan 12, 2010 2:44 pm
Location: EU

Post by nwbdan » Tue Jun 15, 2010 9:01 am

I've just come across this wonderful program called revoSleep.
You can download it here
http://revosleep.realspooky.de/

There's a x64 and x86 version.
I have been using it all day long, without a problem in Windows 7 Pro x64.

Basicly just install it, select which drive you want to shut down (it only shows the first partition in each HDD) and click GO!. That's it.

Just be sure to run it as Administrator.

I have copied all the files I use most often to another partition on my OS HDD. So now I just basicly spin down my backup drive (which also stores most of my media) and run a weekly backup. I was looking for a program like this for a very long time. I hope it can be of use to some.

Quietstick
Friend of SPCR
Posts: 38
Joined: Wed Jul 01, 2009 4:00 pm
Location: Perth

Virtual Hybrid drive?

Post by Quietstick » Fri Jul 30, 2010 8:02 pm

Great contributions people! Thanks.

Now the next step is to only use spare capacity in your SSD when you're around and get the SSD to offload automatically onto your mechanical HDD when you're not. :wink:

"If a drive makes a noise when there's no one around to hear it, does it make any sound?" Silence.... 8)

Check out my previous question - no detailed answers unfortunately, perhaps someone could contribute.

Thanks!

viewtopic.php?t=55315&highlight=

dan
Posts: 1243
Joined: Sun Jan 25, 2004 2:01 am
Contact:

Re:

Post by dan » Fri Feb 11, 2011 9:07 pm

nwbdan wrote:I've just come across this wonderful program called revoSleep.
You can download it here
http://revosleep.realspooky.de/

There's a x64 and x86 version.
I have been using it all day long, without a problem in Windows 7 Pro x64.

Basicly just install it, select which drive you want to shut down (it only shows the first partition in each HDD) and click GO!. That's it.

Just be sure to run it as Administrator.

I have copied all the files I use most often to another partition on my OS HDD. So now I just basicly spin down my backup drive (which also stores most of my media) and run a weekly backup. I was looking for a program like this for a very long time. I hope it can be of use to some.
can you upload the program? the d/l doesn't work :(

dan
Posts: 1243
Joined: Sun Jan 25, 2004 2:01 am
Contact:

Re: batch scripts for turning off hard drives from windows

Post by dan » Thu Mar 24, 2011 10:02 am

I googled it and found it, it works great!

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

Re: batch scripts for turning off hard drives from windows

Post by zsero » Thu Mar 24, 2011 10:30 am

dan wrote:I googled it and found it, it works great!
Maybe they got a huge hosting bill, because of the soundtrack on the page :-). I got google results for the 64-bit zip, but not for the 32-bit:
http://www.google.co.uk/search?sourceid ... TA_x64.rar

But they have a board, I'm sure if you post there someone will send it to you. I would be good to collect it and upload to ifile.it, for example.

dan
Posts: 1243
Joined: Sun Jan 25, 2004 2:01 am
Contact:

Re: batch scripts for turning off hard drives from windows

Post by dan » Tue Mar 29, 2011 8:06 am

zsero wrote:
dan wrote:I googled it and found it, it works great!
Maybe they got a huge hosting bill, because of the soundtrack on the page :-). I got google results for the 64-bit zip, but not for the 32-bit:
http://www.google.co.uk/search?sourceid ... TA_x64.rar

But they have a board, I'm sure if you post there someone will send it to you. I would be good to collect it and upload to ifile.it, for example.
i have an iram card 4gb and a samsung 250gb and i can turn off the samsung hd when i read or surf the web. it works great.

akwok
Posts: 49
Joined: Tue Jan 25, 2005 8:46 am

Re: batch scripts for turning off hard drives from windows

Post by akwok » Sun May 15, 2011 1:17 am

Sorry for bumping up this old thread. While the batch scripts work great for a few minutes, the unmounted drives still spin up after 5-10 minutes. I'm using Windows 7 -- has anyone encountered similar issues? :-(

JJ
Posts: 233
Joined: Sat Jul 10, 2004 12:24 pm
Location: US

Re: batch scripts for turning off hard drives from windows

Post by JJ » Sat Oct 27, 2012 11:55 am

I don't see the point to begin with. Isn't Windows own power management sufficient, spinning down idle hard drives after some configurable number of minutes?

ezechiel1917
Posts: 6
Joined: Thu Dec 22, 2011 12:47 am

Re: batch scripts for turning off hard drives from windows

Post by ezechiel1917 » Sun Nov 11, 2012 4:30 am

JJ wrote:I don't see the point to begin with. Isn't Windows own power management sufficient, spinning down idle hard drives after some configurable number of minutes?
Not really, windows power management is pretty disappointing, random drive spin ups (MFT/ tracking.log) and to mention installers and similar programs spins up all drives when they check for free space. Noisewise really annoying also with the increased wait time to be allowed to continue when all drives spins up. Not possible to fix otherwise than these scripts, which are only useful if you want to use the drives only locally. :(

JJ
Posts: 233
Joined: Sat Jul 10, 2004 12:24 pm
Location: US

Re: batch scripts for turning off hard drives from windows

Post by JJ » Sun Nov 11, 2012 8:56 am

ezechiel1917 wrote:
JJ wrote:I don't see the point to begin with. Isn't Windows own power management sufficient, spinning down idle hard drives after some configurable number of minutes?
Not really, windows power management is pretty disappointing, random drive spin ups (MFT/ tracking.log) and to mention installers and similar programs spins up all drives when they check for free space.
You're not going to avoid this by shutting down drives manually. They'll still spin up when accessed.

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

Re: batch scripts for turning off hard drives from windows

Post by zsero » Sun Nov 11, 2012 9:22 am

JJ wrote:
ezechiel1917 wrote:
JJ wrote:I don't see the point to begin with. Isn't Windows own power management sufficient, spinning down idle hard drives after some configurable number of minutes?
Not really, windows power management is pretty disappointing, random drive spin ups (MFT/ tracking.log) and to mention installers and similar programs spins up all drives when they check for free space.
You're not going to avoid this by shutting down drives manually. They'll still spin up when accessed.
33, what these scripts do is they unmount the drives. They won't be able to be accessed. Their drive letter will disappear from windows, until mounted back. Only SMART utilities can access them this way.

Cistron
Posts: 617
Joined: Fri Mar 14, 2008 5:18 am
Location: London, UK

Re: batch scripts for turning off hard drives from windows

Post by Cistron » Sat Jan 26, 2013 3:12 am

Has anyone found a way to implement this with a simple powershell script for Windows 7? Just pop a file on the Desktop and execute whenever would be ideal.

ezechiel1917
Posts: 6
Joined: Thu Dec 22, 2011 12:47 am

Re: batch scripts for turning off hard drives from windows

Post by ezechiel1917 » Mon Aug 05, 2013 8:47 am

I hate Windows power management, this used to work when I initially tested it, however I'm using Ubuntu for samba server where spin down actually works like it's supposed to.
When I played again with Windows last week drives were randomly spinning up even though they were offline in disk management...
svchost.exe still randomly accessed ntfs metadata ($Mft, $LogFile, $Bitmap etc) of offline drives. There seems to be no way to disable this behaviour.

I wish I could have Windows based server (I need various windows applications) with only SMB access waking up drives :((
I really don't get it. Why do you have drive power management in Windows when it is not working properly :(

Pappnaas
Posts: 726
Joined: Mon May 16, 2011 11:23 am
Location: Germany

Re: batch scripts for turning off hard drives from windows

Post by Pappnaas » Mon Aug 05, 2013 10:17 pm

ezechiel1917 wrote:I hate Windows power management, this used to work when I initially tested it, however I'm using Ubuntu for samba server where spin down actually works like it's supposed to.
When I played again with Windows last week drives were randomly spinning up even though they were offline in disk management...
svchost.exe still randomly accessed ntfs metadata ($Mft, $LogFile, $Bitmap etc) of offline drives. There seems to be no way to disable this behaviour.

I wish I could have Windows based server (I need various windows applications) with only SMB access waking up drives :((
I really don't get it. Why do you have drive power management in Windows when it is not working properly :(
There are a lot of services doing "hidden" things on your HDDs when system is idle. Ever configured some of them? Because in most cases you'll find out that e. g. Windows Search is perriodically updating index or something similar.

Just blaming windows for svchost.exe lets me guess you do not know what exactly that .exe does.

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

Re: batch scripts for turning off hard drives from windows

Post by zsero » Tue Aug 06, 2013 2:32 am

If you don't have SMART monitoring tools active (accesses hard drives by direct access, not by volumes / partition), no buggy defrag utility, no buggy virus scanner, actually Windows 7 is really nice with hard drive management.

Some time ago I stopped using these scripts and just let Windows 7 power up and down the harddrives after 2 min, and I can work ours without hard drives spinning up.

ezechiel1917
Posts: 6
Joined: Thu Dec 22, 2011 12:47 am

Re: batch scripts for turning off hard drives from windows

Post by ezechiel1917 » Tue Aug 06, 2013 4:48 am

Good for you. Wish I could do that... Something is still accessing my drives and I'm unable to do anything with it more than identifying that NTFS metadata are being accessed for some reason. I don't have any smart sw (unless it is integrated in Intel RST SATA driver by default...) disabled defrag/windows search/superfetch and some other suspectful services but that didn't really help. Even if I could nail it down, it won't prevent regular spin-up of all drives when I run any software installer etc, will it?

I will appreciate any help if you think it is possible to run windows based file server, where only smb access actually wake up that specific drive. I've spent many hours with windows desktop OS and it curently seems impossible to do so.

Pappnaas
Posts: 726
Joined: Mon May 16, 2011 11:23 am
Location: Germany

Re: batch scripts for turning off hard drives from windows

Post by Pappnaas » Tue Aug 06, 2013 6:25 am

Windows Server 2008 and 2012 were never designed to save power.

What i do not understand is the fact that you WANT your HDDs to spin down. In dependance on how many times the HDDs will have to be powered up and need a small power consumption peak to do so vs. running constantly at a given power consumption, you might end up using more power.

As HDDs typically do not consume high amounts of power, i wonder as to why exactly they have to spin down.

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

Re: batch scripts for turning off hard drives from windows

Post by zsero » Tue Aug 06, 2013 7:20 am

Pappnaas wrote:Windows Server 2008 and 2012 were never designed to save power.

What i do not understand is the fact that you WANT your HDDs to spin down. In dependance on how many times the HDDs will have to be powered up and need a small power consumption peak to do so vs. running constantly at a given power consumption, you might end up using more power.

As HDDs typically do not consume high amounts of power, i wonder as to why exactly they have to spin down.
^ Hint: Maybe because the name of this site starts with SILENT?

ezechiel1917
Posts: 6
Joined: Thu Dec 22, 2011 12:47 am

Re: batch scripts for turning off hard drives from windows

Post by ezechiel1917 » Tue Aug 06, 2013 8:59 am

zsero wrote:
Pappnaas wrote:Windows Server 2008 and 2012 were never designed to save power.

What i do not understand is the fact that you WANT your HDDs to spin down. In dependance on how many times the HDDs will have to be powered up and need a small power consumption peak to do so vs. running constantly at a given power consumption, you might end up using more power.

As HDDs typically do not consume high amounts of power, i wonder as to why exactly they have to spin down.
^ Hint: Maybe because the name of this site starts with SILENT?
:P Something one would never guess...? I don't care about power consumption, just want silence unless data requested over network. Also I was specifically talking about desktop os.

JJ
Posts: 233
Joined: Sat Jul 10, 2004 12:24 pm
Location: US

Re: batch scripts for turning off hard drives from windows

Post by JJ » Tue Aug 06, 2013 9:10 am

Even in the name of silence, I can't believe anyone would bother manually running a script to shut down a drive instead of letting the OS do it a couple minutes later.

To say that you're overthinking this thing would be a gross understatement. Try not to let your OCD get the better of you.

zsero
Posts: 95
Joined: Mon Jan 07, 2008 3:51 pm
Location: Edinburgh, Scotland

Re: batch scripts for turning off hard drives from windows

Post by zsero » Tue Aug 06, 2013 9:48 am

JJ wrote:Even in the name of silence, I can't believe anyone would bother manually running a script to shut down a drive instead of letting the OS do it a couple minutes later.

To say that you're overthinking this thing would be a gross understatement. Try not to let your OCD get the better of you.
JJ, some people are using scripts because the OS is for some reason never wants to turn off a drive. In this case a script helps.

Yes, Linux is much better for very specific tweakings like these. In Windows you just cannot do anything if some process accesses your harddrive.

Post Reply