Create a Distributed File System Namespace in Windows Server 2012 R2

Last Update: Sep 04, 2024 | Published: Mar 11, 2015

SHARE ARTICLE

In this Ask the Admin, I’m going to demystify the process of setting up a Distributed File System (DFS) namespace in Windows Server 2012 R2.

DFS namespaces provide users with a logical way to access files without needing to know their physical location. Sitting in front of your physical file servers, a DFS namespace is a hierarchy of UNC paths that don’t reference the actual file servers, but transparently redirect users to the nearest copy of the data via NTFS shares. DFS can also help to mitigate some of the issues commonly associated with migrating or consolidating existing file servers, such as maintaining UNC paths during migration projects.

When used with DFS replication, IT can provide users access to local copies of their data in different geographical locations without needing to pull data across expensive wide-area networks. DFS replication is an optional feature, and in this article I want to concentrate only on the namespace aspect of the equation.

Distributed File System Concepts and Terminology

A DFS namespace can be created even if you only have one file server, and the file server itself can act as a namespace server, i.e. the server where DFS will be installed and the namespace configured. The folders that contain the data to be accessed are known as folder targets, and even when they are located on the namespace server, they must be shared because DFS doesn’t differentiate between folder targets located on the namespace server or remote file servers.

When configuring a DFS namespace, you create a DFS root on a namespace server. This root must also exist as a shared folder. In Figure 1 below, you can see a DFS root (\contosopublic) configured on a namespace server with folder targets (Tools and Training Guides) being directed to a series of remote file servers.

A Distributed File System (DFS) Namespace (Image Credit: Microsoft)
A Distributed File System (DFS) Namespace (Image Credit: Microsoft)

There’s also a folder called Software. DFS folders are optional, existing purely to provide extra flexibility in organizing the namespace hierarchy. So for example, a user can access Tools using \contosopublicsoftwaretools and will be transparently redirected to the London or New York server depending on their physical location. Similarly, \contosopublicTraining Guides will direct users to the Training share on the New York server.

Create a DFS Namespace

For simplicity I’m going to create a DFS namespace called files in Windows Server 2012 R2. Theres only one file server (contososrv1) in my domain, and this will be where I install the DFS bits, and it will act as the namespace server. To configure and install the DFS namespace feature, log in to the file server with domain administrative privileges, open a PowerShell prompt and type the command below:

​
The file server currently has no shared folders, so I'm going to create three folders: sales, accounts, and production; and a folder for the namespace (DFS root), using the mkdir cmdlet. Note that you can use existing shared folders that are already populated with files.
​
Once the folders have been created, they need to be shared. The code below shares each folder using the New-SMBShare cmdlet, giving Everyone full access.
​
Now that the necessary folders and shares are in place, I can create the DFS namespace using the New-DfsnRoot cmdlet. \ad.contoso.comfiles is the UNC path for accessing the namespace, and \contososrv1files is used to specify the DFS root namespace server and path. The –Type parameter can be set to one of three values:
  • Standalone for a namespace that's not integrated with Active Directory
  • DomainV1 for a Windows 2000 Server mode domain namespace
  • DomainV2 for a Windows Server 2008 mode domain namespace
For more information on the differences between standalone and domain-based namespaces, see Planning a DFS Architecture, Part 1 on the Petri IT Knowledgebase. Before selecting the DomainV2 mode, make sure that the forest-functional level is set to Windows Server 2003 or higher, the domain functional level is set to Windows Server 2008 or higher, and that all namespace servers are running Windows Server 2008 or later.
Creating a DFS namespace in Windows Server 2012 R2 (Image Credit: Russell Smith)
Creating a DFS namespace in Windows Server 2012 R2 (Image Credit: Russell Smith)
Finally, we need to add the folder targets to the namespace, i.e. sales, accounts, and production, which are separated from the DFS root in the shares folder. The code below adds each share to the files namespace:
​
Now users can access the namespace in File Explorer from any domain-joined device using \ad.contoso.comfiles, and the sales, accounts, and production folders can be populated with files.

SHARE ARTICLE