DFS Replication and "temporary" files

Hello world!
This is my first publish, hope in the future I will write often.
If something is misfiled, correct, I will correct as necessary.

The work had to deal with an interesting characteristic of the DFS Replication. Although he considered a question not new, to fill it bumps can be many.

So we have a stable operating environment in which successfully configured and working DFS replication. Created a replication group, it added all the required servers, the topology is correct, the schedule too, all is well... until one day the new files added to the replicated folder does not cease to be copied to remote servers.

For example, I made a test environment with just two servers LAB-DC1 and LAB-FS1. Each of them has a folder C:\DFSR, between which and should be replicated.

Copied to this folder on LAB-DC1 two test file and see that on the second server atriplicifolia only one.

image

Why?


Because the mechanism of DFS Replication are arranged so that by design does not copy the files whose attribute is set to Temporary. Use the command fsutil and see which attributes have both of our file.

The file not-a-temporary-file.txt has the attributes 0x20:


The file temporary-file.txt has the attributes 0x120:


To decode these hex numbers is very simple. Every possible file attribute is its hexadecimal value. Here all possible variants:
the the the the the the the the the the the the the the
READONLY 0x1
HIDDEN 0x2
SYSTEM 0x4
DIRECTORY 0x10
ARCHIVE 0x20
DEVICE 0x40
NORMAL 0x80
TEMPORARY 0x100
SPARSE_FILE 0x200
REPARSE_POINT 0x400
COMPRESSED 0x800
OFFLINE 0x1000
NOT_CONTENT_INDEXED 0x2000
ENCRYPTED 0x4000

From this list it is seen that not-a-temporary-file.txt only has "Archive" and temporary-file.txt — the attributes "Archive" and "Temporary".
And all files that have "Temporary" will not be replicated through the mechanism of DFS Replication.

To remove this attribute from all sub files and folders is very simple with a small PowerShellscript:
the
Get-ChildItem C:\DFSR -recurse | ForEach-Object -process {if (($_.attributes-band 0x100) -eq 0x100) {$_.attributes = ($_.attributes-band 0xFEFF)}}


Remove the attribute and voila! Our "problem" file temporary-file.txt successfully copied to the remote server:


Where in the network are the "temporary" files — history is silent. I have had to come from somewhere. In order to experiment, you can set the file attribute "Temporary" hands. For this, too, can use a simple PowerShellscript:
the
$file = Get-Item C:\DFSR\temporary-file.txt
$file.Attributes = 0x120


That's all, I hope that this article will help someone else in solving the problems related to the work of DFS Replication.

Finally I want to say thank you to Craig Landis, who back in 2008-m year published in his blog a comprehensive statue on this topic.
Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

A Bunch Of MODx Revolution + LiveStreet

Monitoring PostgreSQL with Zabbix

PostgreSQL load testing using JMeter, Yandex.Tank and Overload