Junctions in Windows 2008 R2

This topic describes how to use junctions with containers created on the Microsoft Windows 2008 R2 platform.

For backward compatibility to applications that use the hard-coded path \Documents and Settings, you can use a junction to redirect \Documents and Settings to \Users instead of resolving the user settings location using environment variables or the registry entry.

For example:

1 2 3 4 5 6 HOMEPATH=\Users\Administrator USERPROFILE=C:\Users\Administrator APPDATA=C:\Users\Administrator\AppData\Roaming LOCALAPPDATA=C:\Users\Administrator\AppData\Local HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

Creating Containers

A container that is created in Windows 2008 R2 may have the folder \Users\<UserName> and it may or may not have the Documents and Settings junction.

There are also junctions under \Users\<UserName>\, which may be copied into the container during creation.

Docking Containers

When docking a container in Windows 2008 R2, if the \Documents and Settings folder does not exist in the container, VirtaMove creates a junction to point to \Users. For example:

1 2 3 4 5 6 7 8 9 10 11 12 C:\VirtaMove_dbg\Debug>dir c:\appliances\useradmin\cstore_C /a Volume in drive C has no label. Volume Serial Number is 90C5-95FE Directory of C:\appliances\useradmin\cstore_C 04/06/2009  03:16 PM    <DIR>          . 04/06/2009  03:16 PM    <DIR>          .. 04/01/2009  10:40 AM    <DIR>          VirtaMove 04/06/2009  03:16 PM    <JUNCTION>     Documents and Settings [\??\c:\appliances\useradmin\cstore_C\Users] 04/01/2009  10:40 AM    <DIR>          Users                0 File(s)              0 bytes

Undocking Containers

When undocking a container in Windows 2008 R2, if the \Documents and Settings junction exists in the container, it is removed. The junction is recreated the next time the container is docked. Note that if \Documents and Settings is a regular folder, it will not be removed.

Moving Containers

Junctions that are created during container creation are relative to the container’s location. Therefore, a junction will become invalid if the container is moved to a different location. For example, if the C:\Appliances\useradmin appliance is moved to D:\Appliances\useradmin.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 C:\Program Files\VirtaMove>dir C:\appliances\useradmin\cstore_C\Users\Administrator /a Volume in drive C has no label. Volume Serial Number is 90C5-95FE Directory of c:\appliances\useradmin\cstore_C\Users\Administrator 04/01/2009  10:40 AM    <DIR>          . 04/01/2009  10:40 AM    <DIR>          .. 04/01/2009  10:40 AM    <DIR>          AppData 04/01/2009  10:40 AM    <JUNCTION>     Application Data [\??\c:\appliances\useradmin\cstore_C\Users\Administrator\AppData\Roaming] 04/01/2009  10:40 AM    <DIR>          Contacts 04/01/2009  10:40 AM    <JUNCTION>     Cookies [\??\c:\appliances\useradmin\cstore_C\Users\Administrator\AppData\Roaming\Microsoft\Windows\Cookies] 04/01/2009  10:40 AM    <DIR>          Desktop                4 File(s)      1,114,132 bytes               24 Dir(s)  24,302,391,296 bytes free