In this blog post, we’ll cover the basics of the Distributed File System (DFS) in Windows Server 2008, which offers users simplified access to a set of file shares and helps administrators easily maintain the file server infrastructure behind those file shares, including options for load sharing, replication and site awareness.
Many File Servers and File Shares
It’s a common scenario. Over time, a company ends up with a large number of file servers that were created at different times and by different teams. The users are left to figure out where their files are stored, mapping many drives to file shares and learning complex UNC paths like \\server23\ffiles and \\finance.asia.company.com\spreadsheets and even something like \\10.1.23.45\scratch. To complicate things further, when an old file server is replaced, paths are broken and mapped drives stop working. It can be challenging.
You also probably heard the proposition to invest in a complex project to consolidate everything into a large file server or NAS appliance. While those projects will solve the problem for a while, you will need to spend a lot of resources to move the data around and fix users’ mapped drives and paths. All that to have that new server eventually become too small and need replacing again. Or you will need many of those larger servers, starting the cycle over.
It turns out it doesn’t have to be that way. Windows Server already provides a way to manage a large set of file shares as a consolidated list, under common namespaces. From your users’ perspective, each namespace looks like a single file share with many folders. From an administrators’ perspective, you can easily add more file servers or consolidate existing file servers without complex “forklift” migrations. And those are just a few of the benefits of DFS.
Adding the DFS Services
DFS Services are available on all currently supported versions of Windows Server, but there are significant improvements in the Windows Server 2008 editions. The DFS namespace client is available for all currently supported versions of Windows, both client and server. Domain-based DFS namespaces require the use of Active Directory.
To add the DFS Services to Windows Server 2008, you will use the Server Manager tool. First, you need to expand the “Roles” item on the tree to make sure that the File Service role is installed. Then you will right-click on “File Services” and click on option to “Add Role Services”. That’s where you you will find the option to add DFS:
Another way to add the DFS Services is using the ServerManagerCmd.EXE command line tool. You can also use ServerManagerCmd to make sure that the right role and role services are installed. Here’s a sample command line:
C:\>servermanagercmd -query | find “[FS”
A DFS namespace is basically a place where you will have links to all your file shares. From an administrator point of view, you should think of it as a folder structure where you keep the list of target file shares. Your users will see it as a single share with many folders and they will have no idea that they are navigating across a set of servers to get to the subfolders and files.
When configuring DFS, you have a choice of using a domain-based or a stand-alone namespace. If you already have Active Directory deployed, you should consider using a domain-based namespace. If you’re not using Active Directory, your only choice is a stand-alone one.
The main advantage of the domain-based namespaces is that your configuration will be stored in Active Directory and you won’t have to rely on a single server to provide the namespace information to your clients. The path users refer to uses the name of the domain and it will not need to change because your namespace server name changed (only if you change your domain name). With a stand-alone DFS, that server name becomes part of the main path to the namespace.
There are also two domain-based DFS modes: Windows Server 2008 mode and Windows Server 2000 mode. Windows Server 2008 mode (which requires Windows Server 2003 forest functional level, Windows Server 2008 domain functional level and Windows Server 2008 running on all namespace servers) includes support for more than 5,000 folders with targets per namespace and access-based enumeration.
Creating a Namespace
After you install the service, your next step is to create the namespace. Here’s are the steps to create a domain-based namespace:
Start “DFS Management” from the “Administrative Tools”. On the tree on the left side, click on “Namespaces”.
Click on “New Namespace…” action on the panel on the right to start the “New Namespace Wizard”.
Enter the name of the namespace server and click “Next”.
Enter the name of the namespace and click “Next”.
Select the type of Namespace and click “Next”. In my case, I’m using a domain-based namespace with 2008 mode enabled. On the review screen, click “Create” and then click “Close” when it’s done. You will end up with a brand new namespace with no folders:
Note: DFS-N “namespaces” are also sometimes called “namespace roots” or simply “roots”. This naming convention was used in older versions of DFS-N and you will also see it in the command-line tools.
Adding Folders to the Namespace
After your create the namespace, you will add folders to it, specifying the associated folder target. This means pointing to the actual file shares, making each one appear to users as a folder under the namespace. Before you do that, you want to think long and hard about the folder structure you’re creating. A basic goal of DFS is to create a stable infrastructure that will not constantly change on your users.
To start, click on the “New Folder…” action on the panel on the right. In the example below, I will enter the name of the folder which as “Finance”. I will also enter one associated folder target, which will be “\\JOSEBDA-N2\FinanceDocs” (this share was configured beforehand). Here are the results right before I click “OK” to create the new folder:
Finally, here’s the end result in the “DFS Management” window:
I could also have folders with no targets (just to create a hierarchy in the namespace) or folders with multiple folder targets.
Note: DFS-N “folders” are also sometimes called “links”. DFS-N “folder targets” and also sometimes called “link targets”. These naming conventions were used in older versions of DFS-N and you will also see it in the command-line tools.
It’s useful to have multiple copies of the same data stored in different file servers. One reason for that is fault-tolerance (if one server is unavailable, you can still access the other one). The other reason is to choose the copy of the data that is closer to you. If you’re in a branch office and you want to access a very large file, you would rather get a copy from a server in that branch.
It’s actually quite simple to add more folder targets to an existing folder or create the folder with multiple targets initially. All you have to do is make sure that you provide the multiple targets for the same folder in that namespace when you configure it.
If you’re using domain-based DFS, the clients will be directed to the target that is closest to them. If there is no target nearby, the clients will be pointed to a remote one. This is similar to what happens when clients are looking for a domain controller. DFS uses the site information in Active Directory to determine which server works best.
Having multiple file servers serving the same data is also useful for maintenance. If you need to apply a security update or add some memory to the server, you can count on the fact that there is at least another server out there that can service client requests while that specific server is down.
At this point, you’re probably thinking: How does the data get copied across multiple servers?
Well, Windows Server includes a component to replicate data between file servers in case you need that. It’s called DFS-R (Distributed File System Replication). DFS-R was introduced with Windows Server 2003 R2 (replacing the old NTFRS with many advantages). DFS-R can be used for both domain-based and stand-alone DFS.
To replicate files between two (or more) shares, you need to create a replication group and specify a few things like which servers will replicate (members) and what they will replicate (replicated folders). DFS-R is aware of site topology. It also has options to control scheduling and the use of bandwidth (throttling). DFS-R uses Remote Differential Compression (RDC), meaning that only changes in the files are sent over the network, not the entire file.
There are specific changes in Windows Server 2008 DFS-R, including improved performance, better network bandwidth utilization, quicker recovery from unexpected shutdowns and support for Read-Only Domain Controllers.
When you create multiple folder targets for a folder, the DFS Management tool will offer you to automatically setup the replication group:
Assuming you have installed the DFS-R role service on both servers, it will go ahead and setup replication for you. It’s done via the “Replicate Folder Wizard”.
To start, it will ask you the replication group name and the replicated folder name:
It will then verify if the server working as folder targets for that DFS folder can be a replication member. Our two servers are eligible:
Next, you need to select one of the servers as the primary member. This should be the server that contains the files you want to replicate and will be the authoritative server during the initial replication:
You will also need to select a topology. This is important if you have a larger number of servers and need to control how they replicate. For instance, if you have a central server in HQ and several branch servers, you can make sure the branch servers do not try to replicate with each other directly, but always replicate only with the HQ servers. In our case, with only two servers, “Full Mesh” will do:
Finally, you need to select the bandwidth and schedule. This will allow you do restrict the amount of bandwidth that DFS-R can use and also specify specific times during the day when replication is allowed. In this case, I will keep it simple, replicating at all hours and using the full bandwidth.
After the review screen, the wizard will set up replication for you. Here’s the end result:
As you saw, the most common administration activities related to DFS-N and DFS-R can be performed using the “DFS Management” MMC. This tool will show up under “Administrative Tools” after you add the DFS role service in Server Manager.
You can also add just the MMC for remote management of a DFS namespace server from a server that does not have the actual DFS Services installed. You will find that option in Server Manager, under Add Feature, Remote Server Administration Tools (RSAT), Role Administration Tools, File Services Tools.
Another way to manage DFS-N is to use DFSUTIL.EXE, which is a command line tool. There are plenty of options and you can automate pretty much any DFS-related activity, from creating a namespace to adding folders to exporting the entire configuration to troubleshooting. DFSUTIL.EXE is an in-box tool in Windows Server 2008. Here’s a sample screen for DFSUTIL:
Note: DFSCMD is an older version of the DFS-N command-line tool. You should use DFSUTIL instead.
For DFS-R, the command line tool is DFSRADMIN.EXE. Here’s a sample screen:
I hope this provided you a good overview of DFS. There’s a lot more to talk about, as you probably guessed. One could write an entire book on this. If you like what you read so far, I suggest you start working with it on a test environment and look at the links below for additional information. You users will thank you…
TechNet on DFS
DFS Step-by-Step Guide for Windows Server 2008
DFS Step-by-Step Guide for Windows Server 2003 R2
DFS FAQ (from Windows Server 2003 R2)