Category: NTFS

Preventing System Volume Information buildup
article #1507, updated 128 days ago

The overall cause of buildup of orphan shadows in “System Volume Information” folders, is physical storage not being able to keep up with demand.

The best first steps I have, are to run what I sometimes call general cleanup. After that, I run PrivaZer without checking traces in free space, which saves time and does not affect performance results. PrivaZer cleans up an amazing variety of NTFS issues, even new installs often benefit.

And after that, three registry entries. Here’s Powershell code to get them in and engaged.

$NewMaxShadowCopies = 8
$NewMinDiffAreaFileSize = 128

# http://www.tomsitpro.com/articles/powershell_registry-powershell_command_line,2-152.html

function setupDWORD {
    param( [string]$regPath, [string]$nameForDWORD, [long]$valueForDWORD )

    ##############
    # Error out if cannot touch the registry area at all
    If ( !(Test-Path $regPath) ) {
        Try {
            New-Item $regPath -Force -ErrorAction SilentlyContinue
            }
        Catch {
            Write-Error ("Could not visit or create registry path " + $regPath)
            Return
            }
        }

    #############
    # If an existing registry entry exists, store its value to report later
    Try {
        $oldValueProperty = Get-ItemProperty -Path $regPath -Name $nameForDWORD -ErrorAction SilentlyContinue
        $oldValue = $oldValueProperty.$nameforDWORD
        }
    Catch {
        $oldValue = ""
        }

    #############
    # Report the changes to make
    Write-Output ("DWORD to write: " + $nameForDWORD)
    Write-Output ("at registry path " + $regPath)
    If ($oldValue -ne "") {
        Write-Output ("Original value is " + $oldValue)
        }
    else {
        Write-Output "No original present."
        }
    Write-Output ("New value is " + $valueforDWORD)

    ############
    # Report no changes to make, set new registry entry, or error out
	If ($oldValue -eq $valueforDWORD) {
		Write-Output "No change to make."
		""
		Return
		}
    Try {
        New-ItemProperty -Path $regPath -Name $nameForDWORD -Value $valueForDWORD -PropertyType DWORD -Force -ErrorAction SilentlyContinue > $null
        }
    Catch {
        Write-Error "Failed!"
        ""
        Return
        }

    "Succeeded!"
    ""
    }

setupDWORD "HKLM:\System\CurrentControlSet\Services\VSS\Settings" "MaxShadowCopies" $NewMaxShadowCopies

setupDWORD "HKLM:\System\CurrentControlSet\Services\VolSnap" "MinDiffAreaFileSize" $NewMinDiffAreaFileSize

setupDWORD 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows' 'DeleteStaleTaskCache' 1

""

"Restarting VSS..."

Restart-Service -Force -Name "VSS"

""

"Complete!"
""

Categories:      

==============

Use TAKEOWN and ICACLS with very long paths and filenames
article #1361, updated 1456 days ago

If there are very long folder or file names, or the path is just too long somewhere down in the tree, this will fail:

ICACLS X:\folder /Q /C /T /reset

but this will succeed:

ICACLS "\\?\X:\folder" /Q /C /T /reset

Apparently the latter incorporates a different API somewhere in the chain.

For TAKEOWN, we just have to run it in Powershell, not CMD.

Powershell code to do it all at once, while CD’d to the level just above, using command-line parameter to specify folder name, is here:

param(
[string]$location
)

$iexcmd = 'TAKEOWN /F ' + '"E:\Shared Data\' + $location + '" /R /D Y'
Write-Progress -Activity "Reset Permissions" -CurrentOperation $iexcmd -PercentComplete -1
Write-Host $iexcmd
iex $iexcmd | Out-Null

$iexcmd = 'ICACLS ' + '"\\?\E:\Shared Data\' + $location + '" /Q /C /T /reset'
Write-Progress -Activity "Reset Permissions" -CurrentOperation $iexcmd -PercentComplete -1
Write-Host $iexcmd
iex $iexcmd | Out-Null

Categories:      

==============

How to Delete an NTFS Junction or Symbolic Link
article #1313, updated 1686 days ago

These can be very dangerous. Recently during a Windows 10 upgrade, C:\Windows.old contained a Users folder where the subfolders were all junctions to the live profile folders in C:\Users. Trying to delete Windows.old almost produced disaster.

To handle this, first check and see what your objects are, with DIR /A in CMD. If you have a junction or a symbolic link, convert it to a simple empty folder/directory first:

fsutil reparsepoint delete foldername

and then delete:

rmdir /s /q foldername

Categories:      

==============

High Memory Use on Servers by NTFS Metafiles
article #1199, updated 2097 days ago

Great info here:

http://woshub.com/fixing-high-memory-usage-by-metafile-on-windows-server-2008-r2/

using this for investigation:

https://technet.microsoft.com/en-us/library/ff700229.aspx

and this service for cure:

http://www.microsoft.com/en-us/download/details.aspx?id=9258

Categories:      

==============

FSUTIL Tweaks for NTFS Performance and Reliability
article #1145, updated 2240 days ago

FSUTIL is a general-purpose NTFS tweak tool. Here is a set of changes which appears to be helpful in general towards performance:

fsutil 8dot3name set 1
fsutil behavior set memoryusage 2
fsutil behavior set disablelastaccess 1
fsutil resource setavailable C:\
fsutil resource setlog shrink 10 C:\

In order:

  • Turns off 8dot3name creation. Does not invalidate existing 8dot3names.
  • Increases RAM cache devoted to NTFS.
  • Turns off “last access” timestamp storage for files. Disindicated for some older backup systems.
  • Makes the filesystem more focussed on “availability” and less on “consistency”.

And here are some which increase reliability:

fsutil repair set C: 0x01
fsutil resource setautoreset true C:\
fsutil resource setconsistent C:\

In order again:

  • Turns autorepair on for C: drive.
  • Cleans transactional metadata on next mount
  • Makes the filesystem more focussed on “consistency” and less on “availability”.

Do be aware that “resource setavailable” and “resource setconsistent” are opposites, both do not get set at the same time :-) Also neither of them appear to be valid on system volumes, errors are thrown.

Here is one set which seems to balance reliability and performance boost:

fsutil 8dot3name set 1
fsutil behavior set memoryusage 2
fsutil behavior set disablelastaccess 1
fsutil repair set C: 0x01
fsutil resource setautoreset true C:\
fsutil resource setconsistent C:\
fsutil resource setlog shrink 10 C:\

Categories:      

==============

Tweaking the Windows File System
article #847, updated 2923 days ago

The command is FSUTIL.

https://technet.microsoft.com/en-us/library/cc753059.aspx

The following usages enhance speed. There are caveats for each.

  • Don’t do this if you use compression :-)
    FSUTIL behavior set disablecompression 1
  • Don’t do this if you use Microsoft built-in encryption!
    FSUTIL behavior set disableencryption 1
  • This one interferes with some backup and file-sync systems.
    FSUTIL behavior set disablelastaccess 1
  • This will interfere with very old software, or software whose updates do not comply with Microsoft’s recommended practices, especially involving DOS-style short filenames.
    FSUTIL behavior set disable8dot3 1
  • Designates more RAM for disk cache. Only use if you have ample RAM. Default is zero, 1 is an option.
    FSUTIL behavior set memoryusage 2

This one may decrease speed a tad, but should increase reliability. Does not work with system drives, it is unclear as to why.
FSUTIL resource setconsistent E:\

This one resets NTFS transaction logs at reboot, this can eliminate many issues of filesystem slowdown over time which have to do with a kind of corruption which CHKDSK does not catch.
fsutil resource setautoreset true c:\

This one reserves more disk space for file tables; can be 1, 2, 3, or 4. Makes handling of large quantities of files more efficient. Unfortunately only helps for partitions created after the setting is made.
FSUTIL behavior set mftzone 4

Categories:      

==============

Full wipe and recreate of the NTFS transaction record for a system drive
article #848, updated 3133 days ago

Here is a procedure which reportedly does a full wipe and recreate of the NTFS transaction record for a system drive. The commands below need to be run in an administrative CMD, then the machine rebooted. ‘setautoreset’ tells the system to do a smaller-scale reset at every boot, it is not known whether there is any reason to set it back to ‘false’ after the reboot is complete. The procedure appears to be able to eliminate some extremely stubborn Windows Update errors, as well as alleviating some situations where NTFS volumes become very slow in accessability. Setting setautoreset to true, all by itself with a reboot, has been seen to help quite a lot too.

fsutil resource setautoreset true %SystemDrive%\

attrib -r -s -h %SystemRoot%\System32\Config\TxR\*
del %SystemRoot%\System32\Config\TxR\*

attrib -r -s -h %SystemRoot%\System32\SMI\Store\Machine\*
del %SystemRoot%\System32\SMI\Store\Machine\*.tm*
del %SystemRoot%\System32\SMI\Store\Machine\*.blf
del %SystemRoot%\System32\SMI\Store\Machine\*.regtrans-ms

Categories: