Windows DFS

The links below lead to sections within this page.


Distributed File Sharing(DFS) Overview

DFS was introduced in Windows NT, and then developed further in subsequent Windows releases. DFS consists of two parts, DFS Name Spaces and DFS Replication

The idea behind DFS Name Spaces is to hide the location of a file or directory from a user, so that if a file or disk moves around the user is unaware of the details. There is no requirement to change drive mappings or add extra drive letters. This also means that if data is moved onto new servers, or consolidated, this can also be transparent to users. The user does not need to know or care about the physical location of the file, only where it is located in the hierarchical view. That means that users no longer search for files by opening file servers and disk drives, and looking through a separate directory structure on each. Instead, users look through a logical directory that places shared information in a place that makes more sense to users and administrators alike.

DFS Replication is about having more than one copy of data distributed around your enterprise. Windows will automatically direct clients to use the closest DFS server and If that server fails, then you will be automatically switched to another DFS server. DFS can also refer to alternate data volumes, which can be used to balance performance by spreading the workload. The effectiveness of application failover depends on how quickly an application can detect that a disk has failed. Once the failure is detected, the application will switch to another disk. However open files cannot be failed over and might be unusable.

The two terms that are critical to understanding DFS are:
The DFS root is the starting point for DFS links and is visible on the Network.
A DFS link is a pointer from the DFS root to another share on the Network. When someone clicks on the link they are redirected to the network share.

The original DFS replication product was FRS, which was replaced by DFSR in Windows Server 2003 R2. The main improvements that DFSR introduced were:

  • Replication works at block level instead of file level. This means that if a large file such as a database or an outlook pst file is changed, only the changed blocks are replicated, not the entire file.
  • DFSR uses compression, which, combined with block level replication above, reduces the amount of replication traffic on the network.
  • DFSR has better scheduling capabilities so replication can be timed to run a times when network traffic is lower than normal.

back to top


The DFS root and DFS volumes

The starting point for DFS is the DFS root, which is a local share that hosts other shares. You define and administer the DFS root from 'Start', 'Programs', 'Administrative Tools', 'Distributed File System'.

There are two types of DFS root, stand-alone or domain-based.

  • A stand-alone DFS root can have only a single level of DFS links and cannot have root-level DFS shared folders.
  • A domain-based DFS root can have multiple levels of DFS links, can have root-level DFS shared folders and must be hosted on a domain member server.

A DFS volume is the combination of a DFS root, and the DFS links attached to it. A DFS volume is accessed using a standard UNC name:

\\Server-Name\Dfs-Share-Name\Path\File

where Server-Name is the name of the host computer, Dfs-Share-Name is your DFS root, and Path\File is any valid Win32 path name.

A volume can contain thousands of shares. If you access a remote share, then the system caches certain information locally. The next time you accesses that share, you access the local cache, rather than pulling a fresh copy from the remote server.

It is possible for this cache to be either pointing to the wrong location or to be corrupt, usually identified by the informative message "Server cannot find network path of DFS name space"

To fix this you need to have 'File Services Tools' installed on the server. If you don't have them installed, you can find them in Server Manager, Add Feature, Remote Server Administration Tools (RSAT), Role Administration Tools, File Services Tools. Once you have them installed, open a command window as Administrator and run the command

dfsutil cache referral flush

This should clear your cache without a server reboot and the share should be accessable again.

back to top


How to set up DFS Namespaces in Windows Server 2016

First you need to instal the DFS Role. Login to your Windows 2016 Server, and open the Server Manager console. click on the 'Add roles and features' option and this will start up the Add roles and features wizard. Click on 'Next' to continue, then from the wizard, choose 'Role-based or feature-based installation' on the next screen as shown below.


click on 'Next' to continue, select your destination server from the list in the next screen, and click on 'Next' again. Expand the 'File and Storage Services' and select DFS Namespaces from the list. Note that if you wanted to install DFS Replication on Windows 2016, it appears on this list too.


Now you need to install the Management tools so select it from the 'Add Features' wizard.


Click on Next on the rest of the screens. then click on 'Install' to install the DFS role


Now you have installed the DFS role, you can start to configure DFS. Open the DFS Management console, right-click 'Namespaces' and choose 'New Namespace'. Then type the name of the server that will host the namespace on the next screen. Click on 'Next' then choose a name for your namespace in the following screen. this will be the name of your domain sharing path, for example lascon/TSM_files


Now click on 'Edit Settings..' and edit the permissions on the share and set them as required. By default everyone gets 'read'. Click on 'Next' and on the following screen choose the Namespace Type. Domain Based namespace is selected below.


Click on 'Next', check your settings and then click on 'Create'. You have now created a NameSpace, but it is empty, so the final step is to create some DFS folders. From your DFS Management console, right-click the namespace you just created, and choose 'New Folder'. Type the name of the folder, then click on 'Add'


Type the path of the Shared folder you want to add to the Namespace then click on 'OK' Now you can test your DFS Namespace is working by typing the network path in Explorer ( e.g lascon/files ) and you should see the folder you just added.

back to top


Shares

Windows allows you to mark directories or files as 'shares', which means that other users on a Network can access them. To enable shares for a drive with Windows 10, right on the drive name, select 'share with' then 'advanced sharing', then the 'advanced sharing' button. Click the 'Share this Folder' radio button, then you can give the share a meaningful name, as it will default to the drive letter. You can also define what access people get with the 'permissions' button. By default the 'Everyone' user group will get read access. The 'cache' button is used to decide what happens if the share is offline.

Administrators can link shares together to create a single volume that looks like one massive hard drive to the users. Individual users can define their own DFS volumes as above, and these can be combined with other DFS volumes using inter-DFS links. Suppose you define the c: drive on your PC as a DFS volume. If you then turn your PC off, the volume is unavailable, but that does not affect any of the other DFS volumes in the DFS volume name space.
DFS will support either FAT or NTFS format DFS roots. If you cross a 'junction' to a DFS root with a different format, you change from one file format to the other.

back to top


DFS Applications

DFS can simplify server replacement. Every node in the DFS directory is assigned a logical name that points to a file share. The DFS node can be switched to point to a new server and the users do not know that they are accessing a different server. The logical names can be descriptive.

DFS can also simplify backup, especially if you need to backup workstations. The workstations can all be defined as DFS nodes, and then processed from a single root. The only issue is that your backup utility will not be able to re-create the DFS if a recovery is needed. You need to rebuild the DFS tree first before recovering the workstations. You could also apply the same principle to group all your servers together into a single volume, but the backup time will probably be excessive. If you chose to do this, you need to make sure that your recovery plan takes DFS into account.

You can run virus scanning and content indexing over several volumes from a single DFS root too, but make sure that any application you run that scans files is 'DFS Aware' and will not trigger unnecessary replication.

Managing DFS

There are at least two ways to manage your DFS environment, you can use the 'DFS Management' MMC, which will appear in 'Administrative Tools' after you add the DFS role service in Server Manager, or you can use the Dfsutil command from an Administrator command line.

A selection of dfsutil commands include

  • To add a new root in a domain based DFS:
    dfsutil /addftroot: new_dfs_root_name /server: dfs_server_name /share: dfs_share_name
  • To create a new stand-alone namespace:
    dfsutil root addstd \\SRV02xx01\StandaloneNamesapce1
  • To delete the namespace root
    dfsutil root remove \\lascon.co.uk\DomainNamespace1
  • To display information about the links:
    dfsutil link \\lascon.co.uk\DomainNamespace1
  • To add a link to a namespace:
    dfsutil link add \\lascon.co.uk\DomainNamespace1\link1 \\server\share
  • To delete a link and any associated targets:
    dfsutil link remove \\lascon.co.uk\DomainNamespace1\link1

DFS Backup and Restore

The dfsutil command can also be used to backup and recreate a DFS namespace. To backup the namespace use the following command to create a script file. Add the 'downlevel' parameter if you need your export to be WIN2003 compatible. The sytax is export dfs_name file_name as shown below.

dfsutil root export \\lascon.co.uk\DomainNamespace1 C:\dfsexport\exp021113.txt

To recreate a DFS namespace, use the import command. Two options are available, SET which creates a new namespace and MERGE which combines the information from the import file with any that exists in the namespace. If conflicts occur, then the data in the import file takes precedence. There is also a COMPARE option that lets you see what will happen before running the import. The examples below show sample file and share names.

dfsutil root import compare C:\dfsexport\exp021113.txt \\lascon.co.uk\DomainNamespace1
dfsutil root import set C:\dfsexport\exp021113.txt \\SRV02xx01\DomainNamespace1
dfsutil root import Merge C:\dfsexport\exp021113.txt \\SRV02xx01\DomainNamespace1