Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
    
possible duplicate of Moving users folder on Windows Vista/Seven to another partition –  surfasb Dec 23 '11 at 23:08

3 Answers 3

up vote 3 down vote accepted

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>.

share|improve this answer
    
Is there a problem with using this method for the c:\users directory? Do I leave the directory OriginalLocation in place after moving its files and subdirectories, or do I remove it before creating the link? Any better or worse methods of moving the files and subdirs? –  foosion Dec 23 '11 at 18:01
    
@foosion: You move the folder by moving it more or less. There aren't any magical shortcuts to moving data across drives unfortunately. Safest route for moving your user folder is to move it from outside Windows. Safe Mode from the Command Prompt works. I personally don't recommend moving it while logged into Windows but sometimes you can get away with it. Move first, then drop a link where it use to be. Like Hansen and Gretel. –  surfasb Dec 23 '11 at 20:12
    
@surfasb, does one move the folder, as you say (so nothing is left) or move all the files (as Chris says), which would leave the empty folder? –  foosion Dec 23 '11 at 20:22
1  
@foosion: Move the folder. He said files, but he means folders in that sense. If you move just the files, you'll need to link each and every file back to its original spot. Move the folder, link the folder. I'm pretty sure there are some very good tutorials out there. –  surfasb Dec 23 '11 at 22:59
    
@surfasb: there are a bunch of tutorials out there. The problem is that they don't all agree. For example, the method in my OP came from a nice looking technet tutorial. –  foosion Dec 24 '11 at 11:33

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'.

share|improve this answer
    
This is incorrect: 1) fsutil takes a filename, not a folder 2) You can't hardlink to another volume. On an unrelated note, I'd recommend Link Shell Extension. –  surfasb Dec 23 '11 at 20:08
    
2surfasb: My answer was to use FAR Manager which does work with folders. You are right in that fsutil only works with files, but this is also obvious from the usage notes in my original answer. –  ccpizza Jan 13 '12 at 14:02

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.