2

I plan to install an msata SSD drive on my notebook to hold windows and programs, while keeping data files, the users directory, etc. on the old HD.

It would be easier if I could continue to refer to the data files as c:\whatever, even though they are physically in d:\whatever.

If I understand correctly, the best way is to create a junction, such as

mklink /j d:\whatever c:\whatever

Do I then just move the old directory and all its subdirectories to d:\whatever, using windows explorer or something from the command line? Or would create circularity problems?

Windows7x64 Pro, if that matters.

foosion
  • 481

3 Answers3

3

I do exactly the same thing to move large data files from my SSD on C: to another hard drive.

You need to move the folder first.

Then, create a symbolic link (or junction if you prefer, in this case they provide the same functionality) from the original location to the destination location using the command:

mklink /D OriginalLocation DestinationLocation

The /D makes a symbolic directory link which can span volumes. (Edit: Junctions may also span volumes)

Using Windows Explorer, you'll see a little shortcut icon on the folder of the original location. Using dir /a on the parent directory will show <SYMLINKD> in place of <DIR>.

surfasb
  • 22,896
0

The steps I use are as follows. I moved Users and ProgramData to another drive.

1) boot into system disk, access command prompt, find your old C:\ Drive, and make a note of the destination drive letter

robocopy /copyall /e /xj Users <CURRENT_LETTER_OF_DESTINATION_DRIVE>:\Users
robocopy /copyall /e /xj ProgramData <CURRENT_LETTER_OF_DESTINATION_DRIVE>:\ProgramData
Rename Users Old_Users
Rename ProgramData Old_ProgramData
cd Old_Users
attrib desktop.ini -S -H
Rename desktop.ini desktop.ini.old

This keeps a copy of your users folder as "Old_Users". I moved this elsewhere as a backup. If you don't change the .ini file you might not be able to distinguish the two folders later!

Optionally rmdir /s /q Users and rmdir /s /q ProgramData if you are clearing the space.

2) then

mklink /J Users <USUAL_LETTER_OF_DESTINATION_DRIVE>:\Users
mklink /J ProgramData <USUAL_LETTER_OF_DESTINATION_DRIVE>:\ProgramData
rmdir "Documents and Settings"
mklink /J "Documents and Settings" "<USUAL_LETTER_OF_DESTINATION_DRIVE>:\Documents and settings"

Now when you restart windows all should be OK.

If you make a mistake, you might end up with a broken user profile. In that case, go to safe mode (or another user) and open regedit at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList. Your old user profile will probably be in the list with a .bak extension, and a new dummy one in its place. Delete the dummy profile and rename the .bak key without the "bak".

You may then encounter several security errors. I had to also do the following:

icacls "%programdata%\Microsoft\Internet Explorer\Quick Launch" /SetIntegritylevel (OI)(CI)Medium
icacls "%userprofile%\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch" /SetIntegritylevel (OI)(CI)Medium
icacls "%userprofile%\AppData\Roaming\Microsoft\Windows\Start Menu" /SetIntegritylevel (OI)(CI)Medium

The ownership of my files also changed somehow and I needed to use "Take ownership", or "Properties/Security/Advanced/Owner/Edit/Replace owner on subcontainers" to get everything working.

-1

FAR Manager can create symlinks using Alt+F6, also the linked folders will be marked with <link> which makes it easier to spot them. Don't know about Windows 7, but in previous versions of Windows, using Explorer to delete a symlinked folder would lead to catastrophic results such as deleting the actual target folder.

To alias files (not folders) you could use: fsutil hardlink create <new filename> <existing filename>.

If FAR Manager is not good enough for you, then you could symlink folders with the junction command line utility by Mark Russinovich, e.g.:

junction d:\symlinked_folder c:\winnt

And no, you can't actually 'move a folder using junction', a junction is just an alias for another folder which the client applications would see as 'the real thing'.

ccpizza
  • 8,241