Hack 97 Back Up the DFS Namespace

figs/expert.gif figs/hack97.gif

If you've implemented the Distributed File System (DSF) on your network, you need to back up your DFS namespace regularly.

The Distributed File System (DFS) is a feature of Windows 2000 Server and Windows Server 2003 that lets you create a single logical tree of shared folders that are physically located on different file servers on your network. This makes it easier for administrators to manage shared folders, and it also helps users find shared resources, since the resources appear from the user's point of view as a single hierarchical set of folders on a single machine. As a result, to locate a particular shared folder on the network, users don't have to know the actual file server on which the folder resides; they just have to connect to the DFS tree and browse until they find the folder they require. Then, if the user has the appropriate permissions to access the folder, he can do whatever he needs to do with the files stored within it.

A collection of shared resources arranged in a logical hierarchy like this is called a DFS namespace. This namespace begins with the DFS root, which forms the bottom of the DFS tree. The branches of the tree are called DFS links and they map to shared folders on different file servers across your network. Windows 2000 Server machines can host only one DFS root (hence, only one namespace), but the Enterprise Edition of Windows Server 2003 supports multiple DFS roots on a single machine.

If you're using DFS, it's important that you back up your DFS configuration for your Windows 2000 domain. Unfortunately, many disaster-recovery products on the market that support Windows 2000 do not have a native add-in to support the backup and restoration of the DFS namespace.

Fortunately, Microsoft has included in Windows 2000 two command-line-based tools (DFScmd and DFSUtil) to facilitate such a need. While the functionality in these tools is also provided in the GUI by the DFS snap-in for the MMC, using the command-line tools gives you the added flexibility of using them to create a script that you can execute via Task Scheduler to automate the backup process if your DFS topology changes often.


The first command-line utility, DFScmd, allows you to back up the DFS namespace to a text file that can be accessed later to restore the namespace if necessary. Here's the syntax to perform a backup:

DFScmd /view \\DFSName\DFSShare /BATCH >> "path\filename.bat"

For example, if you have a domain-based DFS namespace for the domain Consoto.net, with a DFS root named DFSRoot, then your backup syntax would look like this:

DFScmd /view \\Consoto.net\DFSRoot /BATCH >> C:\Temp\dfsbackup.bat

Here's an example of what is saved in this batch file:


REM dfscmd /map "\\consoto.net\DFSRoot" "\\servera.consoto.net\DFSRoot" "DFS Root for 

Consoto.Net members."

dfscmd /map "\\consoto.net\DFSRoot\Departments\Finance" "\\serverb.consoto.net\finance$" 

"Finance Department."

dfscmd /map "\\consoto.net\DFSRoot\Departments\ISS" "\\serverb.consoto.net\dept_iss$" 

"Information Systems Department."

dfscmd /map "\\consoto.net\DFSRoot\Domain Support\IIS Published Sites" 

"\\serverc.consoto.net\inetpub$" "IIS Web Sites published for Internet/Intranet Access."

The command completed successfully.

To restore the DFS volume structure (namespace) from the server it was originally hosted on to a new file server in the domain, perform the following steps. Start Distributed File System from Administrative Tools and on the Action menu click New DFS Root. Click Next and then choose the proper type of DFS root for your domain. Select the server that will host the DFS root and then click Next. Select the share that will become the DFS Root Share and then click Next. Finally, insert a comment, click Next, and then click Finish. The new DFS root is now available.

Now, run the batch file created earlier to restore the DFS volume structure. When the batch file has completed execution, verify that the namespace has been properly created. In our example, the DFS namespace should now appear in the Distributed File System Administrator like this:





    Domain Support

         IIS Published Sites


The second command-line utility, DFSUtil, allows you to query and perform troubleshooting of the DFS metadata with domain-based DFS implementations. DFS metadata is configuration information of DFS that is stored in the Active Directory-based Partition Knowledge Table. The functionality of the command-line-based DFSUtil parallels the functionality of the Distributed File System MMC snap-in.

While DFScmd is a built-in operating system command, DFSUtil can be found on your Windows 2000/2003 product CD under the Support\Tools directory in the SUPPORT.CAB file. If you plan on using these utilities, I recommend you download the latest SUPPORT.CAB file from Microsoft's web site at http://www.microsoft.com/downloads/ if you are running Windows 2000 Service Pack 2 or later. The service packs include updated versions of DFSUtil.exe that resolve issues encountered with the original version found on your Windows 2000 Server CD.

?Matt Goedtel