Stop Windows 7 from flooding the LAN with SMB queries

10

2

I have an annoying problem with a NAS from Western Digital (MyBook Live Duo 6 TB) that is hooked up via a switch to my LAN. There are four Windows 7 machines in the network, one of them connected via WLAN.

Every time someone opens Windows Explorer (no matter which machine, no matter which path), the drive is spinning up, which is not only annoying, but I assume very straining on the drives.

There is no way to change the behaviour of the NAS, so my question is: Is there a way to prevent Windows from "querying" the drive (or all SMB-servers, that is) without totally crippling the file sharing/network access?

(Disabling DHCP on the router is not an option, since it doesn't support separate DHCP settings for wired and wireless.)

Rubbel Katz

Posted 2017-10-16T13:06:36.397

Reputation: 121

1Not really an answer - is your NAS mapped as a network drive on the machines? What happens if you un-map them and use a shortcut to connect to the NAS? Do you still get the spin-up when starting explorer but without going to the NAS? – Baldrickk – 2017-10-16T15:50:24.717

Alternate solution (though nontrivial cost) would be chucking the spinning rust plates and getting SSDs. – R.. GitHub STOP HELPING ICE – 2017-10-16T16:59:49.750

Lets face it: Could it be that the drives are actually not spinning up but instead seeking sectors? This would be audible but as a clicking sound. It would take less time than the 3-5 seconds for spinning up. Windows is requesting information from the drives and the HDD is gathering them. It boils down to a basic seek and read operation – sbecker – 2017-10-16T17:14:21.947

@Baldrickk - No machine has the drive added as a network drive. Having a shortcut to the drive on the desktop on all machines does not change the behaviour at all. – Rubbel Katz – 2017-10-18T15:56:07.153

@sbecker - the drives in the NAS are definately spinning up instead of just seeking, the difference is clearly audible (especially since head seeks are nearly inaudible on this particular device) - also there is a status LED in the front panel of the NAS, which changes from standby/sleep(blue) to green(active) when someone opens the windows explorer – Rubbel Katz – 2017-10-18T15:57:18.387

Answers

2

Continuously browsing the web I was lead to the following 'solution', which is might be kind of uncomfortable for some people, but still retains network access:

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\NonEnum]

"{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"=dword:00000001

Setting the above dword to 1 removes all references of the network environment out of the windows explorer, which also prevents the spinup of my NAS whenever someone opens a windows explorer instance. Downside is, if you ever want to browse the available machines, you have to manually enter the path to the network environment into a windows explorer path textbox. Machine links and everything else still works.

btw, the drives inside this particular NAS are WD REDs

Rubbel Katz

Posted 2017-10-16T13:06:36.397

Reputation: 121

14

Hard drive "spin-up" is a very specific operation with the following characteristics and limitations:

  • For most desktop / consumer HDDs, it takes between 3 and 5 seconds to complete the spin-up process. During the spin-up process, the HDD cannot read or write any data.
  • During the spin-up, if you listen very close to the device, you will hear an increasing pitch sound. At the end of it you will hear a burst of those soft clicks of the HDD's ball bearings moving as the disk "seeks" to various locations (to satisfy the I/O requests that were queued when it started to spin up).
  • Consumer HDDs are designed for thousands of spin-up / spin-down cycles, with some lower quality units failing around 1000-2000 spin-up cycles, but with many being engineered for around 600,000. After this number of spin-up cycles, the mechanisms involved in the process start to break down, and will eventually fail.

On the software side, a well-configured system would generally have one of three sorts of policies around spin-ups/spin-downs:

  • For extreme energy conservation (e.g., in a laptop on battery power), the shortest possible spin-down time you might expect would be around 15 or 30 minutes of inactivity (no disk activity during the period). On modern Windows, we have so many programs running all the time and doing nearly constant I/O that the chances of there being no disk activity for 15 minutes, even on a "clean" system, even with the user completely idle, is virtually zero. In practice, this configuration is uncommon these days.

  • For moderate energy conservation, a typical desktop spin-down time might be around 2 to 4 hours. This means, if no reads or writes occur to that hard drive over a period of 2 or 4 hours (or whatever it's configured to be), the disk will spin down, and the next I/O request to hit it will have to spin the disk back up.

  • For servers, since they are desired to always be available at any instant (without any lag in their response), spin-down due to inactivity is usually disabled. This would apply to a NAS as well as a web server or any other type of server.

I would be surprised if the WD NAS you own is designed out of the box to have an extremely short spin-down time. However, there was a bug in Ubuntu Linux many years ago (in 2007) where they accidentally set the spin-down idle time to 0 seconds. This meant that as soon as the disk stopped handling an I/O request, the "0 second" timer for the spin-down would immediately expire, the disk would spin down, and the heads would park. Then I/O requests would queue up in memory while the disk had to spin up again to handle them.

This constant churn of spin-up / spin-down was killing peoples' hard drives in very short order on Ubuntu in 2007. Folks who didn't notice and correct the problem quickly experienced working HDDs failing in days to weeks (these HDDs were either not designed with frequent spin-up cycles in mind, or they were less than 1 year from failing under normal usage).

If your NAS is constantly spinning up and down, the disks inside it are suffering a sort of mechanical wear that is uncommonly weathered (at this frequency) by HDDs, so it's really kind of a torture test for them. You should attempt to remedy the situation on the NAS itself.

Try the following:

  • Look through every firmware setting on the NAS's configuration pages and make sure you change any power management settings to be as "lax" as possible (minimal power savings / disabled).
  • Update the firmware of the NAS to the latest available from the manufacturer.
  • If you're comfortable opening the NAS chassis, do so, and find the model and serial numbers of the HDDs inside. Then punch those numbers in online and see if you can find firmware updates for the HDDs themselves (you can directly apply the firmware updates from Windows by putting the HDDs into a computer if you can't update their firmware from the NAS interface).
  • If SMART diagnosis is available for the disks, you should check them using a SMART diagnostics program, or look for such in the NAS firmware, as an indication of possible failure.
  • If none of this solves the problem, it's likely that the HDD(s) inside the NAS are defective, or the NAS itself is defective. If the HDDs are experiencing certain types of internal errors, they may be resetting themselves (power off / power on) and as a result are spinning down, then spinning back up.

Now, as to your suspicion that Windows is the problem? It's not. A NAS's disks should not constantly be spinning down after only a few seconds of idle time. They simply shouldn't. Period. No one designs their NAS like that on purpose (well, I wouldn't totally put it past WD to do that, but it's unlikely).

Windows 7 is completely blameless if that's happening because your Windows computer can't control the power management functions of your NAS's SATA controller through the SMB protocol. Only the operating system of the NAS can do that.

What Windows 7 actually does when you open Windows Explorer, is it performs certain SMB operations that query the filesystem metadata to calculate the total and available disk space on the NAS's shared space.

For a hard drive that's spun up and "fully running" at the time of access, calculating the total and available disk space should take less than a second. The request isn't particularly expensive, and it's not "flooding" by any measure.

If you truly believe that Windows is performing some kind of a command flood to the NAS, you should prove it to yourself by installing Wireshark on one of your Windows 7 computers and run a packet sniff on the SMB protocols with an IP destination of your NAS. I would consider it a flood if more than about 100 requests are sent just by opening Windows Explorer, and especially if the requests continue to happen at a very high rate for more than 5-10 seconds after opening Explorer. Otherwise it's more or less normal.

Keep in mind that certain virus scanning and backup products aren't smart enough to realize that a mapped network drive (e.g. F: or something) is a shared drive and, as a result, attempt to do virus scanning or backups on the entire drive (not just the files you access from it deliberately). These sorts of bugs are mostly historical, but can crop up from time to time with certain software. There are also some programs that will faithfully execute a user's instructions if they, for example, configure the program to perform an hourly full virus scan on a shared drive. Once this process begins, it would indeed "flood" the NAS with SMB requests.

So you might want to rule out that sort of thing occurring, but the root cause of the problem in my opinion is that the drive is spinning down in the first place. A good NAS won't let the drive spin down and the heads park until at least 2 hours of total inactivity. If you can open/close Windows Explorer very fast and reproduce the spin-up each time, something is wrong on the NAS side.

allquixotic

Posted 2017-10-16T13:06:36.397

Reputation: 32 256

4To add: some drive firmware ("green") has been known to have a very short idle timer, on the drive itself irrespective of OS settings. And idle spin-down is still common on secondary drives, though perhaps not on the primary system drive these days. – Bob – 2017-10-16T14:00:37.060

@Bob Good observation, but the OS is supposed to be able to customize that idle timer using one of the (ATA?) commands. On Linux, you can set it using hdparm for PATA and SATA I believe. Not sure if those WD Green drives ignore the requests from the OS to increase their spin-down idle time, but they shouldn't if they want to comply with the spec. – allquixotic – 2017-10-16T17:48:45.893

2@allquixotic And as we all know HDD manufacturers are known to follow the SATA standards to the letter and never deviate from them ;) The issue with the greens is well known which makes them horrible drives for NAS - although iirc you can flash the firmware. – Voo – 2017-10-16T18:29:01.520

Maybe I mislead a few people by not stating the exact behaviour of the drive... its not spinning down instantly after a 'valid' access. The problem in my setting is, the drive is maybe used once a week, if even that. But its still spinning up every time someone opens a windows explorer on their computer, no matter the path. I realized it has to do with the Network environment always expanded on the left side in each explorer window. I will post a 'solution' to my question shortly – Rubbel Katz – 2017-10-18T16:03:40.160