Windows

How to use NTFS reparse points along with the CurrentWork technique

Learn how to take advantage of NTFS reparse points to ease file management.

If you're using the NTFS file system on your Windows 2000 or Windows XP system, you can take advantage of NTFS reparse points and my CurrentWork file management technique to reduce the amount of time and effort you spend navigating your hard disk. To help you see how this works, I’ll set up an example.

Let’s suppose that you store a lot of data on your hard drive and you use a very detailed folder structure in order to keep your data organized and to make it easy to find what you're looking for. In this scenario, you may have a folder for each of your projects, and each project folder may have several subfolders with more folders nested inside them. In fact, it's not inconceivable that you could have a folder structure that is nested 10 or more levels deep.

The downside of such a detailed folder structure is that you probably spend a lot of time traversing nested folders from within both Windows Explorer and your application's Open and Save As dialog boxes. Wouldn't it be nice if you could keep your detailed folder structure, yet shorten the path to a single folder name?

Fortunately, you can do just that when you take advantage of NTFS reparse points. This feature allows you to create special links that are designed to configure a folder on an NTFS drive so that it points, or is redirected, to another folder on the same hard disk. In addition, NTFS reparse points will allow you to redirect a folder on an NTFS drive to a specific folder on a secondary hard disk or even to the root directory on a secondary hard disk.

In this Daily Drill Down, I'll get into more detail on how NTFS reparse points work. As I do, I’ll show you how to use Windows 2000 and Windows XP’s native tools, as well as several freeware utilities, to create and work with NTFS reparse points. Along the way, I’ll introduce you to my CurrentWork technique and describe how it takes advantage of reparse points to ease file management operations.

Reparse points aren’t for networks
It’s important to keep in mind that reparse points are specifically designed to work on local hard disks. They don’t work across a network. In other words, you can't create a reparse point on an NTFS drive that points to a network drive.

Reparse points in technical detail
To begin, it's important to acknowledge that while the reparse points feature is new to NTFS version 5, the concept has been around in other operating systems for quite a while. Most notable is a UNIX feature called symbolic links. With that in mind, you could say that NTFS reparse points are basically a Microsoft adaptation of UNIX’s symbolic links feature. The underlying idea in both versions is to allow the operating system to seamlessly link folders and drives together.

Specifically, reparse points are NTFS file system objects that can contain user-configured data that gets stored in the system-administered reparse attribute. In order to differentiate reparse points, each one has a unique reparse tag.

Now, when a file system object that contains a reparse attribute is encountered during a pathname resolution operation, the file system object is passed back up the file system driver stack to the file system filter for an I/O reparse, during which the reparse tag is identified. Working together, the file system filter and the file system drivers use the reparse tag and a globally unique identifier (GUID), which is retrieved from the registry, to identify the reparse point and direct the I/O call accordingly.

In a nutshell, that’s what occurs behind the scenes from the operating system standpoint. From the user standpoint, you open Windows Explorer, double-click a folder configured with a reparse point, and see the contents of a different folder or a different drive.

Breaking down reparse points
In order to further describe how reparse points apply to the CurrentWork technique with the goal of the easing of file management operations, I need to break reparse points down into two of their sub features: mount points and junction points. Here’s a closer look.

Mount points
Mount points are the features that allow you to redirect a folder on one hard disk to the root directory of a secondary hard disk so that when you open the folder, you see the entire contents of the secondary hard disk. One of the main benefits of mount points is that they allow the operating system to work around the 26-drive-letter limitation. While this facet of mount points isn’t the main focus of this article, it’s still worthwhile to investigate since it's the most widely recognized use of reparse points and will help you immediately grasp the power of this feature.

To begin with, it might be hard to imagine using more than 26 drive letters on any one system; however, it’s not inconceivable. Especially when you consider that in addition to having multiple hard disks in a system, which themselves can be partitioned into multiple drives, you can have multiple CD drives and removable storage devices, such as ZIP drives or USB drives, in addition to mapped network drives.

As you can imagine, having 26 drive letters on one system would be quite overwhelming just to look at in My Computer, not to mention all the time and effort it would take to keep track of what data was stored where. And, back in the early NTFS days, if you needed yet another drive, you were out of luck once the 26 letters were already used up.

Using mount points allows you to overcome both of these problems. If you feel like you have too many drive letters to contend with, you can reduce the count by removing the letters from certain drives. You then create various mount points that allow you to essentially graft those “letterless” drives onto empty folders on one of your NTFS drives. When you do so, the contents of a “letterless” drive are then accessible via the folder that the drive was grafted onto.

On the other hand, if you really need all 26 drive letters, you can add another physical disk to the system without assigning it a drive letter. You then create a mount point to graft the new “letterless” drive onto a folder on one of your existing NTFS drives.

When it comes to easing file management operations with the CurrentWork technique, mount points will allow you to redirect a folder on one hard disk to the root directory of a secondary hard disk that has a drive letter assigned to it. For example, you could use the mount points feature to configure a folder in the root directory of drive C:, say C:\CurrentWork, so that it points to the root directory of a secondary hard disk assigned the letter D. You could even use mount points to configure the C:\CurrentWork folder to point to the root directory of a removable media drive, such as a Zip drive, a USB drive, or even a CD-ROM drive.

Junction points
Junction points are the features that allow you to redirect a folder on one hard disk to another folder, either on the same hard disk or on a secondary hard disk. For example, I could use the junction points feature to configure C:\CurrentWork, so that it points to C:\Documents and Settings\Greg Shultz\My Documents\My Work\Freelance\TechRepublic\June 03\Reparse Points. I could also use the junction points feature to configure the C:\CurrentWork folder to point to D:\Freelance\TechRepublic\June 03\Reparse Points.

The NTFS factor and the other drive
If you plan to use reparse points to link a folder on an NTFS drive to a secondary drive, keep in mind that while the reparse point itself must be created on an NTFS drive, the secondary drive can be formatted with either the FAT32 or the NTFS files system.

The native tools
Now that you have a basic idea of what reparse points are all about, let’s take a look at some of the tools that you can use to create and work with mount points and junction points.

Working with mount points
Creating mount points is relatively easy because Microsoft included tools in both Windows 2000 and Windows XP for creating and working with mount points. The easiest place to create mount points is in the Disk Management Console.

To launch the Disk Management Console, access the Run dialog box by pressing [Windows]-R, typing diskmgmt.msc in the Open text box, and clicking OK. When you see the console, locate and right-click the drive or partition for which you want to create a mount point and select the Change Drive Letter And Paths command. When the Change Drive Letter And Paths dialog box appears, click the Add button. You’ll then see the Add Drive Letter or Path dialog box. Select the Mount In The Following Empty NTFS Folder option button. When you click the Browse button, you’ll see the Browse For Drive Path dialog box. Select the folder to which you want to assign the mount point. Figure A illustrates this entire procedure and shows the mount point being assigned to the C:\CurrentWork folder. To complete the operation, just click OK twice and then close the Disk Management Console.

Figure A
Once you open the Browse For Drive Path dialog box, you can select the folder to which you want to assign the mount point.


Folder must be empty
Keep in mind that the folder to which you want to assign the mount point must be an empty folder. If you select a folder that contains files, the OK button will be unavailable.

When you’re finished with the mount point, you can terminate the link by again accessing the Disk Management Console, selecting the drive, opening the Change Drive Letter And Paths dialog box, and clicking the Remove button. You’ll then see a confirmation dialog box that prompts you to confirm the link termination. Just click Yes and you’ll be returned to the Disk Management Console.

Now if you’re a real glutton for punishment, you can use a command-line utility called Mountvol to create mount points. However, I can tell you from experience that using Mountvol can be an exercise in futility. The reason is that you have to type the GUID—a lengthy alphanumeric string that the operating system uses to refer to the drive—on the command line.

For example, to create a mount point on the C:\CurrentWork folder to the CD-ROM drive on my example system, I’d have to meticulously type the following command:
Mountvol C:\CurrentWork \\?\Volume{e621f1f0-cbee-11d6-a8a9-06d6172696f}\

Considering how easy it is to create mount points in the Disk Management Console, I highly recommend that you bypass the Mountvol command-line utility. If you’re still interested in learning more about the Mountvol command, you’ll find detailed documentation in the Windows XP Help and Support Center, as well as online at the Windows 2000 Professional Documentation site.

Working with junction points
When it comes to creating junction points, the only Microsoft utility designed to create junction points doesn’t even come with the operating system. This command-line utility is called Linkd.exe and is only available in the Windows 2000 Resource Kit. However, unlike the Mountvol utility, the Linkd.exe utility is very easy to use. Furthermore, even though the Linkd.exe utility is only available in the Windows 2000 Resource Kit, it works just fine in Windows XP.

For example, to create a junction point with the C:\CurrentWork folder that points to the C:\Documents and Settings\Greg Shultz\My Documents\My Work\Freelance\TechRepublic\June 03\Reparse Points folder, I’d use the following command:
Linkd C:\CurrentWork "C:\Documents and Settings\Greg Shultz\My Documents\My Work\Freelance\TechRepublic\June 03\Reparse Points"

As you can see, since I’m working on the command line and the target path contains long names with spaces, I have to enclose the target path in parenthesis.

When you’re finished with the junction point, you can terminate the link with the command:
Linkd C:\CurrentWork /D

The one drawback with this command is that in addition to terminating the link, it will also delete the C:\CurrentWork folder. However, since the link is terminated first and C:\CurrentWork folder is actually empty, you needn’t be concerned about data loss.

To learn more about the Linkd utility, see the Windows 2000 Resource Kit documentation. You can also view the online help by running the Linkd command without any parameters.

The freeware tools
There are several freeware tools for working with reparse points that I encourage you to investigate. The first one is called Junction Link Magic from Rekenwonder Software. Once you download and install this little utility, you’ll find a very nice GUI that allows you to easily create and delete junction points, as shown in Figure B. Another big plus for Junction Link Magic is that it also allows you to create and delete mount points.

Figure B
Junction Link Magic allows you to easily work with both junction points and mount points.


The second freeware tool, simply called Junction, comes from Mark Russinovich at SysInternals and is a command-line utility that allows you to create junction points. It works exactly like Microsoft’s Linkd utility.

Caveats
Working with NTFS reparse points isn’t for the casual user or the faint of heart, as it does come with a number of nasty pitfalls that are easy to find if you don’t really understand what you’re doing and you’re not careful. For instance, you can delete a reparse point from within Windows Explorer or from the command line with the Del command. However, rather than just deleting the reparse point, these commands can actually delete the target directory and all subdirectories. So it's extremely important that you only use utilities that are specifically designed to work with reparse points when it is time to get rid of them.

Microsoft even goes so far as to advise you to use access control lists (ACLs) to protect both the folders assigned to a reparse point and the target files and folders if there is a potential for another user to accidentally delete your reparse points.

Reparse points can also wreak havoc with certain utilities, such as backup programs, that aren’t reparse-point aware. You might also notice that the Dir command reports odd free-space statistics on drives that contain folders acting as reparse points.

The CurrentWork file management technique
In the introduction, I mentioned that my CurrentWork file management technique takes advantage of reparse points and is designed to reduce the amount of time and effort you spend navigating your hard disk in both Windows Explorer and in your application's Open and Save As dialog boxes. You may have also noticed that the folder acting as the main reparse point in all my examples was titled CurrentWork.

Ever since I discovered the benefits of reparse points, I’ve kept a folder in the root directory of the NTFS drive named CurrentWork. As I begin each new writing assignment, I create a junction point that redirects the C:\ CurrentWork folder to a folder that is deeply nested in the folder structure that I use to keep my work organized. As I finish an assignment, I remove that junction point and then create a new junction point for the next assignment. Of course, this means that the target folder is always changing as I move from assignment to assignment. However, once I create the new junction point, the only folder name I have to navigate to when opening, saving, or copying files related to the assignment is the C:\ CurrentWork folder. Since beginning the practice, I've saved an immeasurable amount of time and frustration.

Anyway, now that you know how to use NTFS reparse points along with the CurrentWork technique, you can take this concept and apply it to the way you work. Chances are good that once you get into the habit, you too will reap the benefits of reparse points.

About

Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.

2 comments
tsilis
tsilis

you are definitely a teacher!!! Just like reading a novel or a science fiction book and travelling through time and space.It's probably the most easy to understand and thorough all the way.thanks a lot....i think you opened my eyes a little bit :)

parahumanoid
parahumanoid

While the displayed material is of some use, I believe the title is misleading. After all, it explores only 3 Microsoft's standard applications of reparse point technology, while its spectrum of use is truly boundless. Remote storage, by the way, is another Microsoft implementation that uses this technology. However, a more generic article on the topic would be welcome on the site, bringing up some examples of other, free-flight uses of this technology. For example, Nokia's PC Suite, when recognizing a Nokia phone connected to the PC, shows a browsable projection of the mobile phone in My Computer as a separate entity. Can anyone bring up more examples of "other", non-standard uses for this technology? It would be an interesting list to examine.

Editor's Picks