How to Change SMB Directory Leasing Timeout in Regedit
Server Message Block (SMB) directory leasing improves network
file-sharing performance by caching directory listings and file metadata
on client machines. In Windows, the duration and timeout behavior for
SMB directory cache and leasing operations are managed through specific
registry values located in the Windows Registry (regedit).
Modifying these parameters allows network administrators to fine-tune
caching durations, balance network traffic, and resolve latency or
consistency issues during shared folder access.
The Primary Registry Value: DirectoryCacheLifetime
The specific registry value that controls the duration for SMB
directory leasing and caching operations on a Windows client is
DirectoryCacheLifetime.
- Registry Path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters - Value Name:
DirectoryCacheLifetime - Data Type:
REG_DWORD - Default Value:
10(seconds)
When a client queries a directory over SMB2 or SMB3 with directory
leasing enabled, the server grants a directory lease. The client holds
directory metadata locally for the duration specified by
DirectoryCacheLifetime before requesting updated metadata
from the server. Setting this value to 0 disables directory
caching entirely.
Related SMB Metadata Caching Registry Values
Along with DirectoryCacheLifetime, Windows uses two
additional values in the same registry path to control file information
and missing file cache timeouts:
1. FileInfoCacheLifetime
- Path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters - Value Name:
FileInfoCacheLifetime - Data Type:
REG_DWORD - Default Value:
10(seconds) - Function: Determines how long file properties (such as file size and timestamps) are cached locally.
2. FileNotFoundCacheLifetime
- Path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters - Value Name:
FileNotFoundCacheLifetime - Data Type:
REG_DWORD - Default Value:
5(seconds) - Function: Determines the duration the client remembers that a requested file does not exist, preventing repeated failed lookup requests to the server.
How to Configure DirectoryCacheLifetime in Regedit
Press Windows Key + R, type
regedit, and press Enter to open the Registry Editor.Navigate to the following path:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\ParametersLook for the
DirectoryCacheLifetimeentry in the right pane:- If it exists, double-click it, select Decimal, and enter the desired timeout duration in seconds.
- If it does not exist, right-click an empty area in the right pane,
select New > DWORD (32-bit) Value,
name it
DirectoryCacheLifetime, and set the timeout value in seconds.
Click OK.
Restart the computer or restart the Workstation service (
LanmanWorkstation) to apply the changes.