Moving an IMAP pst-file or Hotmail ost-file

Icon of a Symbolic Link to a Hotmail ost-file.While you can determine the location of pst-files belonging to a POP3 account or ost-files for an Exchange account for yourself, determining the location of the pst-file for an IMAP account or the ost-file for a Hotmail account is much more troublesome.

This can lead to issues as these files can grow quite large and the disk or partition on which you have Windows installed might not be accommodated for that. Especially if you invested in a fast SSD-drive, you usually don’t have GB of space to waste and rather locate this data on your larger data drive.

While you can force the location of new pst- and ost-files via Registry values, you’ll need to recreate the IMAP account and download all mail again. Hotmail accounts do not even respect these Registry values at all.

An effective and more direct solution is to use Symbolic Links. While the matter around them and how they function is quite complex, using them is luckily fairly easy and they are a very effective solution for this issue.


ForcePSTPath and ForceOSTPath Registry values

If you are using an IMAP account and have the opportunity to re-download all your mail again, then using the ForcePSTPath Registry value is the recommended way to go.

This Registry key allows you to set the default location for all newly created pst-files.

Key: HKEY_CURRENT_USER\Software\Microsoft\Office\<version>\Outlook
Value name: ForcePSTPath
Value type: REG_EXPAND_SZ
Value: path to your storage folder

As the Value you give the path to the folder where you want to keep your pst-files. You do not need to use quotes for this path, even if it contains spaces.
Example; D:\Documents\Outlook Files

Outlook 2010’s split pst-file personality:
While Outlook 2010 locates all manually created pst-files and pst-files for POP3 already under the Documents\Outlook Files folder, it does not do this for pst-files created for IMAP and SharePoint accounts. For these account types the pst-files are still located in the Local Settings or AppData folder of the user profile. The reason for this is that the pst-files from IMAP and SharePoint accounts are not actually judged as data-files but merely as a cache as the originals will remain on-line and Outlook holds a 2-way sync relationship.

Similar to the ForcePSTPath Registry value, there is the ForceOSTRegistry value. However, even though Outlook Hotmail Connector accounts use ost-files, it doesn’t respect this Registry value and always creates its ost-file in the default location.

The ForceOSTPath Registry value does work as it should for Exchange accounts.

Control the location of newly created ost-files and pst-files via the ForceOSTPath and ForcePSTPath values in the Registry.
Control the location of newly created ost-files and pst-files via the Registry.

What exactly Symbolic Links are and how they function is a bit too much and too complex to explain for this guide but you can use Wikipedia if you really want to learn more.

For now, you can look at Symbolic Links as advanced shortcuts which keep the original extension of the file that it is pointing to (instead of a lnk-file) which tricks the system into thinking that it is actually working with that file from that location rather than the location it is pointing to.

So, in our case, we are going to create a symbolic link for the pst-file of the IMAP account in its original location on the system drive (C:\-drive) which points to the actual file on your data drive. We can do the same for the ost-file of the Connector Hotmail Connector but then it involves an ost-file.

Note:
Even when you only have 1 drive or partition, you can use the method discussed in this guide to move the pst-file or ost-file to another location on that drive such as your Documents folder so that they for instance can be included in your backups more easily.

To create a Symbolic Link, you can use the MKLINK Command line tool in Windows.

In the example below, we assume that the name of the ost-file is hotmail.ost and that we move it from its original location to a location called D:\Documents\Outlook Files

  1. Close Outlook.
  2. Move the ost-file or pst-file from its original location to its new location.
    The default location is; C:\Users\%username%\AppData\Local\Microsoft\Outlook
  3. Open an elevated Command window.
    A quick way to do this is;
    1. Open the Start Menu and immediately type; cmd
    2. Right click on the cmd.exe file and choose; Run as administrator
    3. Provide administrator credentials for your computer or press “Yes” to accept the User Account Control prompt.
  4. Type the following command (of course with your own file names and locations);
     
    mklink "C:\Users\%username%\AppData\Local\Microsoft\Outlook\hotmail.ost" "D:\Documents\Outlook Files\hotmail.ost"

Tip!
You can actually leave the variable %username% in your command. Upon executing, the command it will automatically resolve it to your actual username.

Once you’ve created the symbolic link, the file icon will look like a shortcut in Explorer. However, instead of having the Shortcut file type, it still holds the ost- or pst-extension and the “Outlook Data File” file type. It file size will report as 0KB but the file it is pointing to of course still holds its size; the link to that file simply doesn’t take up any disk space.

Comparison between the properties and look of a Symbolic Link, Shortcut and the original.
Comparison between the properties and look of a Symbolic Link,
Shortcut and the original file (which is marked with 2 in the name).

Undoing the changes
When you want to undo the changes, simply close Outlook, and move the pst-file or ost-file back to its original location and thus overwrite the Symbolic Link.

Creating Symbolic Links on Windows XP

Windows XP doesn’t have the MKLINK Command line tool nor are actual Symbolic links to files not supported in Windows XP. This is because the NTFS driver of Windows XP (including some parts of the Windows XP Kernel) doesn’t provide support for it.

Instead, you can use the FSUTIL or Junction Command line tool for similar functionality.

FSUTIL

When using FSUTIL, you can use the same procedure as discussed above for later versions Windows. However, for FSUTIL the file must remain on the same partition (C:\-drive). While this doesn’t solve the issue of freeing up space on your C:\-drive, it will allow for easier management of the files by linking it to for instance the My Documents folder.

The command to use for FSUTIL is;

fsutil hardlink create "C:\Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Outlook\hotmail.ost" "C:\Documents and Settings\%username%\My Documents\Outlook Files\hotmail.ost"

Note:
It now may look like you’ve only copied the file and that you use twice as much space. In reality, both hotmail.ost files are pointing to the exact same blocks of data on your disk and thus only use up the space once.

Undoing the changes
Simply delete the “copy” of the ost-file or pst-file that you created via the above command line. As the original file still exists in the original location, the data won’t be deleted from your disk.

Junction

The Junction Command line tool doesn’t have the same limitation as FSUTIL which allows you to move the ost-file and/or pst-file to another partition or disk as well. However, Junction only works for entire folder and not for individual files. So to use this method, you’ll need to move the entire Outlook folder and not just the pst-file or ost-file.

The Junction tool is an additional Windows Sysinternals tool which can be downloaded from the Microsoft TechNet website.

After you’ve moved the Outlook folder, the command line to use is;

junction "C:\Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Outlook" "D:\Documents\Outlook Files\Outlook"

Undoing the changes
To undo the changes you can either use Junction or FSUTIL with the following command line;

junction -d "C:\Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Outlook"

or

fsutil reparsepoint delete "C:\Documents and Settings\%username%\Local Settings\Application Data\Microsoft\Outlook"

You’ll of course need to move/copy back the original files afterwards then.

Creating Symbolic Links via a GUI based tool

Aside from the command line tools provided by Microsoft, there are also several 3rd party tools available which allow you to create Symbolic Links via a user interface (GUI).

  • NTFS Link Ext
    This tool offers FSUTIL and Junction functionality via a GUI in Windows XP.
  • Link Shell Extension
    This tool works for all Windows versions later than Windows XP and supports Symbolic Links, FSUTIL and Junction functionality via a GUI. It also contains links to modified NTFS drivers for Windows XP which will allow for the use of real Symbolic Links.