ReFS Disable Integrity Bit

ReFS-Logo

When working with ReFS volumes it is sometimes necessary disable the integrity bit for single files or entire volumes to avoid performance penalties or error messages.

ReFS Integrity bit for Hyper-V

When you move the VHD or VHDX file of an Hyper-V machine to an ReFS volume you need to disable the ReFS integrity bit otherwise you will get an error similar the following

Export failed for virtual machine ‘webtest01’ (16CCE32D-G6B2-4D86-91D1-FFED635D24C6) with error ‘The requested operation could not be completed due to a virtual disk system limitation. On NTFS, virtual hard disk files must be uncompressed and unencrypted. On ReFS, virtual hard disk files must not have the integrity bit set.’ (0xC03A001A).

ReFS Integrity bit for Exchange 20013/2016

With the release of Exchange 2016 ReFS became the recommended file system to host database, log and index files by Microsoft with one of the requirements being the integrity bit disabled at the file or volume level.

ReFS Disable Integrity bit for single file

ReFS integrity bit can be disabled from PowerShell the first step is checking if it is either enabled or not on the file with the following PowerShell command

Get-FileIntegrity 'Z:DB01DB01.edb'

FileName                                Enabled                                 Enforced
--------                                -------                                 --------
Z:DB01DB01.edb                       True                                    True

As you can see the integrity bit is enabled for the DB01.edb file to disable it simply run the following command

Set-FileIntegrity Z:DB01DB01.edb

#Verify that integrity bit has been disabled

Get-FileIntegrity 'Z:DB01DB01.edb'

FileName                                Enabled                                 Enforced
--------                                -------                                 --------
Z:DB01DB01.edb                        True                                    True

Get-FileIntegrity and Set-FileIntegrity Usage

While full help for the two cmdlets is available through the standard PowerShell help system it has to be noted that if running either command without the full file path, for example from within the directory where the files to be modified are, you will receive an error message

PS Z:DB01 Get-FileIntegrity .DB03.edb
Get-FileIntegrity : The system cannot find the file specified.
At line:1 char:1
+ Get-FileIntegrity .DB03.edb
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (MSFT_FileIntegrity:ROOT/Microsoft/...T_FileIntegrity) [Get-FileIntegrit
   y], CimException
    + FullyQualifiedErrorId : HRESULT 0x80070002,Get-FileIntegrity

To overcome this limitation you can specify the full file path or use the Get-ChildItem cmdlet like in the following example

PS Z:DB01 Get-ChildItem | Get-FileIntegrity

FileName                                Enabled                                 Enforced
--------                                -------                                 --------
Z:DB01DB01.edb                        True                                    True
Z:DB01db02.edb                        False                                   True
Z:DB01DB03.edb                        False                                   True

ReFS Disable Integrity Bit for Multiple Files

If you have a folder containing multiple files like in the case of an Hyper-V host with multiple VMs and VHDX files you can use the following command

Get-ChildItem -Recurse | Where {$_.Extension -EQ “.VHD” -or $_.Extension -EQ “.VHDX”} | Get-FileIntegrity | Where {$_.Enabled -EQ $true} | Set-FileIntegrity -Enable $False
Get-ChildItem Z:VHDX -Recurse | Get-FileIntegrity

FileName                                Enabled                                 Enforced
--------                                -------                                 --------
Z:VHDXVHDX0.VHDX                      False                                   True
Z:VHDXVHDX06.VHDX                     False                                   True
Z:VHDXVHDX07.VHDX                     False                                   True
Z:VHDXVHDX08.VHDX                     False                                   True
Z:VHDXVHDX09.VHDX                     False                                   True
Z:VHDXVHDX01.VHDX                     False                                   True
Z:VHDXVHDX02.VHDX                     False                                   True
Z:VHDXVHDX03.VHDX                     False                                   True
Z:VHDXVHDX04.VHDX                     False                                   True
Z:VHDXVHDX05.VHDX                     False                                   True

[su_note note_color=”#ffff96″ text_color=”#000000″ radius=”5″]Note: The Set-FileIntegrity cmdlet does not return any output upon successful execution [/su_note]

ReFS Disable Integrity Bit for a Volume

ReFS integrity bit can also be disabled at the volume level but this has to be performed when the ReFS volume is being created with the following command

format /fs:refs /q /i:disable <volume>

 Summary

If you are creating a ReFS volume to host VHD/VHDX or Exchange databases you need to disable the ReFS integrity bit to avoid issues which can be done at the file or volume level.

It has to be noted that when creating new files on a ReFS volume the integrity bit is disabled by default so the above steps need to be applied to files that already have the integrity bit set.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s