Difference between revisions of "Windows/Move Documents and Settings"
(→Dump) |
|||
Line 1: | Line 1: | ||
Windows XP puts all of the user profile data into the <tt>%SystemDrive%\Documents and Settings</tt>. While this is ok with most settings where you only have 1 disk with one partition sometimes the space on the <tt>%SystemDrive%</tt> gets smaller and smaller and smaller and can affect system performance. In one particular case I had a much larger <tt>D:</tt> drive and I wanted to move all the users' data to it. This is how I went about the task. |
|||
== Dump == |
|||
⚫ | |||
== Proof of concept - move one user == |
|||
The first thing to do is to login as <tt>Administrator</tt> and pick a user that can be moved. For the sake of this example we use the fictious user <tt>jdoe</tt>. |
|||
* Open the registry editor and navigate to <tt>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</tt> |
|||
* Create a backup of the registry path mentioned above by navigating to the <tt>File</tt> menu and choose <tt>Export</tt>. |
|||
* Look for the users <tt>jdoe</tt> by clicking on the folders starting with <tt>S-1-5-21-1111111111-222222222-333333333-1XXX</tt>. If the number after the last hyphen is <tt>500</tt> it is most likely the <tt>Administrator</tt>'s account. Look for the value of the <tt>ProfileImagePath</tt> as it will contain the users' name at the very end. |
|||
* Edit the value changing the <tt>%SystemDrive%</tt> variable to the desired drive letter in our case <tt>D:</tt>. For our sample user the path should then look something like this <tt>D:\Documents and Settings\jdoe</tt>. |
|||
* Now create a folder called <tt>Documents and Settings</tt> under the <tt>D:</tt> drive. |
|||
* Move the folder <tt>jdoe</tt> from <tt>%SystemDrive%\Documents and Settings</tt> to <tt>D:\Document and Settings</tt> |
|||
* Log out of the <tt>Administrator</tt> account |
|||
* Log into the account <tt>jdoe</tt> and check if everything is working as expected. |
|||
== Move all users == |
|||
After successfully having moved one users it is time to move the rest of the system. |
|||
* Open the registry editor and navigate to <tt>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</tt> |
|||
* Create a backup of the registry path mentioned above by navigating to the <tt>File</tt> menu and choose <tt>Export</tt>. |
|||
* Change every users' <tt>ProfileImagePath</tt> changing the <tt>%SystemPath%</tt> to the new driver letter. '''Note:''' There is one excpetion user <tt><span class="highlight">S-1-5-18</span></tt> is off limits! |
|||
* Reboot the host with a Linux rescue system disc such as [http://www.sysresccd.org SystemRescueCD] |
|||
* Create a directory called /mount and mount the Windows partitions |
|||
mkdir /mount |
|||
ntfs-3g /dev/sda1 /mount/c |
|||
ntfs-3g /dev/sda2 /mount/d |
|||
* Copy the date from <tt>/mount/c/Documents and Settings</tt> to <tt>/mount/d/Documents and Settings</tt> |
|||
rsync -av "/mount/c/Documents and Settings" /mount/d/ |
|||
* To ensure it is working when logging back in we create and <tt>__ARCHIVE__</tt> directory under <tt>/mount/c/Documents and Settings</tt> and move all the previously copied data into it. |
|||
cd "/mount/c/Documents and Settings" |
|||
mkdir __ARCHIVE__ |
|||
mv * __ARCHIVE__ |
|||
* Reboot into Windows again testing if it worked. |
|||
== Ensure new users will end up on the new drive == |
|||
For new users to make sure they land on newly created drive we need to change on more Registry entry. For the sake of readability the command has been split onto several lines. Change the <tt>/d ""</tt> value to the path desired. |
|||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" |
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" |
||
/v ProfilesDirectory |
/v ProfilesDirectory |
||
/t REG_EXPAND_SZ |
/t REG_EXPAND_SZ |
||
/d " |
/d "D:\Documents and Settings" |
||
=== Rollback === |
|||
To roll the above change back run the following commands: |
|||
⚫ | |||
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" |
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" |
||
/v ProfilesDirectory |
/v ProfilesDirectory |
||
/t REG_EXPAND_SZ |
/t REG_EXPAND_SZ |
||
/d " |
/d "%%sysdrv%%\Documents and Settings" |
||
[[Category:Windows]] |
[[Category:Windows]] |
Revision as of 21:05, 16 June 2012
Windows XP puts all of the user profile data into the %SystemDrive%\Documents and Settings. While this is ok with most settings where you only have 1 disk with one partition sometimes the space on the %SystemDrive% gets smaller and smaller and smaller and can affect system performance. In one particular case I had a much larger D: drive and I wanted to move all the users' data to it. This is how I went about the task.
Proof of concept - move one user
The first thing to do is to login as Administrator and pick a user that can be moved. For the sake of this example we use the fictious user jdoe.
- Open the registry editor and navigate to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
- Create a backup of the registry path mentioned above by navigating to the File menu and choose Export.
- Look for the users jdoe by clicking on the folders starting with S-1-5-21-1111111111-222222222-333333333-1XXX. If the number after the last hyphen is 500 it is most likely the Administrator's account. Look for the value of the ProfileImagePath as it will contain the users' name at the very end.
- Edit the value changing the %SystemDrive% variable to the desired drive letter in our case D:. For our sample user the path should then look something like this D:\Documents and Settings\jdoe.
- Now create a folder called Documents and Settings under the D: drive.
- Move the folder jdoe from %SystemDrive%\Documents and Settings to D:\Document and Settings
- Log out of the Administrator account
- Log into the account jdoe and check if everything is working as expected.
Move all users
After successfully having moved one users it is time to move the rest of the system.
- Open the registry editor and navigate to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList
- Create a backup of the registry path mentioned above by navigating to the File menu and choose Export.
- Change every users' ProfileImagePath changing the %SystemPath% to the new driver letter. Note: There is one excpetion user S-1-5-18 is off limits!
- Reboot the host with a Linux rescue system disc such as SystemRescueCD
- Create a directory called /mount and mount the Windows partitions
mkdir /mount ntfs-3g /dev/sda1 /mount/c ntfs-3g /dev/sda2 /mount/d
- Copy the date from /mount/c/Documents and Settings to /mount/d/Documents and Settings
rsync -av "/mount/c/Documents and Settings" /mount/d/
- To ensure it is working when logging back in we create and __ARCHIVE__ directory under /mount/c/Documents and Settings and move all the previously copied data into it.
cd "/mount/c/Documents and Settings" mkdir __ARCHIVE__ mv * __ARCHIVE__
- Reboot into Windows again testing if it worked.
Ensure new users will end up on the new drive
For new users to make sure they land on newly created drive we need to change on more Registry entry. For the sake of readability the command has been split onto several lines. Change the /d "" value to the path desired.
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v ProfilesDirectory /t REG_EXPAND_SZ /d "D:\Documents and Settings"
Rollback
To roll the above change back run the following commands:
set sysdrv=SystemDrive reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList" /v ProfilesDirectory /t REG_EXPAND_SZ /d "%%sysdrv%%\Documents and Settings"