20 October 2009

Manage duplicate files with NTFSLink

NTFSLink is an opensource software that act as shell extension to make creation of hardlink and junction as easy as clicking which is more comfortable than M$ fsutil or other console-based alternatives. Both (hardlink & junction) have been "hidden" part of NTFS in a decade, yet there are not many user use it.

Linux symlinks does better suited here because by using centralized root "/" of filesystem there is no confusion about "where the starting point is?". Here M$ Windows come with multi volumes of C:\ D:\ or more apropriately a mountpoint stuff that imply limitation to hardlink and junction fuctionality. Which in some extent M$ saw that as a threat rather than benefit.

I'll not go into details here (its pretty much low-level stuff), instead I will give some examples:

1. Arrange a repository or such thing in a project involving external dependencies

When I create a project, usually I place it in organized folder like [date]\[project name] or similar. In a project like 3d, cad, webpage, video-editing or flash I work with many other files arround which is generally located in a repository.  Now I not used  to alter repository files directly (always save as somewhere). With junction I could link this folder (in repository) into my own project folder without additional space needed and it will treated like ordinary folder regardless the software I run (It will just always worked). Even with NTFSLink uninstalled it will permanently worked (but without icon folder that indicated a junction).

D:\Repo\Textures\House --> D:\Data\[Username]\[Date]\[Project]\House

We should see the benefit of relative path immediately from that...

2. Spacesaving related

First remember the rule that junction is used to only link folder within volume or across volume (mountpoint) while hardlink is only for files across directories inside the same volume.

A simple example, when I play a games, sometime times its more convenient if we create ISO images to the original CD, installed them (which usually just create a duplicate of  CD content into harddisk) then play. With juntion we could delete the game's data inside installation folder and replace it with junction from Virtual CD Drive instead.

remove "C:\Program Files\MotoGp\pcdata" first
H:\pcdata --> C:\Program Files\MotoGp\pcdata

the same case for Encarta DVD and other related thing..

3. Resolve shared dependencies by hardlink instead of copying duplicate

Say you have a software that rely on a big files (for ex. a database) and you have several several version of it, worse the software didn't give you option to choose the location of the file aka it must be under \db folder. With hardlink you can distribute the large file throughout all version with no diskspace.

Same thing for large shared dll files. Like QT 4.5 Runtime DLLs that generally huge

4. Relocate a folder

Your aging C: partition has running low space. Even so you need to install a software that store its huge temporary files just to failing the installation itself cause you running out of space

Using junction you can relocate your temp folder outside C: partition, thus give your C: some extra breath. All done without messing with registry setting.

remove "C:\Document and Settings\[username]\local settings\Temp"
D:\tmp --> C:\Document and Settings\[username]\local settings\Temp

note: folder didn't need to be the same name, system will read setting from regisitry which is "C:\Document and Settings\[username]\local settings\Temp" then mapped into D:\tmp

But let say "whooa It still not sufficient !" then you felt regret for placing GTA installation in C:\ ? Ok don't uninstall your GTA :) use junction to relocate it to somewhere spacious. Likewise system will recognize GTA as it was installed on C:\Programs Files but when GTA run all with be redirected to new location and your software can now be installed :)


With junction you can create a folder in other partition e.g. D:\Programs\Miktex then junction it to C:\Miktex and then proceed installation with C:\Miktex as installation target thus you will not losing a single bytes on C:\. Same case can be applied to software that just can be installed in C:\

Of course there are endless possibilities of what you can achieve with hardlink and junction.

M$ didn't seems to care much about this feature, as you might eventually wondering why. Infact M$ use it extensively in Vista and 7 to manipulate compatibility with older windows directory structure.
For example there is C:\Document and Settings but there is also C:\Users which one of them contain junctions.

I build shell extension package (freeware including NTFSlink) here

No comments:

Post a Comment