windows icon indicating copy to clipboard operation
windows copied to clipboard

[Feature]: User Data Separation

Open thecreativeone91 opened this issue 1 year ago • 2 comments

Is your proposal related to a problem?

No, enhancement only

Describe the solution you'd like.

Still thinking of ideas on this one but I think it would be good to make the docker container and the VM disk image more disposable. It would be good to see a way with container variables to configure more options; to keep user data outside the disk image. User Profile disks is one option but ideally something file level instead of block would be great. Folder redirection could be an option but with user profiles this can bring other issues and some data not captured (appdata etc) maybe something like fslogix might be an option as well but still block storage but better than user profile disks.

Application separation while extreme would be neat too; though I don't see this doable today as there is no real open source method for this that I know of. Only VMware App Volumes really exists in this space.

Describe alternatives you've considered.

N/A

Additional context

No response

thecreativeone91 avatar Dec 04 '24 20:12 thecreativeone91

I think this should be as simple as adding something like this to the Microsoft-Windows-Shell-Setup component in the unattended answer files:

<FolderLocations>
    <ProfilesDirectory>D:\Users</ProfilesDirectory>
</FolderLocations>

Just add a second drive and point this at it. Could either be another virtual disk or another hard drive mounted into the container. This would at least allow persistence of user data between re-installs of windows. But it doesn't solve the problem of storing the data outside of the virtual disk, it just seperates it from the main windows virtual disk.

This could also allow for some seperation of applications as well since a lot of apps that are installed for "This user only" are generally installed in the users appdata folder.

Source: https://www.tenforums.com/tutorials/1964-move-users-folder-location-windows-10-a.html

harb88 avatar Dec 14 '24 02:12 harb88

I just tested the above and it almost works as expected.

I had to add a second disk to the unattended answer file so it mounts with the correct drive letter:

        <!-- Second hard drive -->
        <Disk wcm:action="add">
          <DiskID>1</DiskID>
          <WillWipeDisk>false</WillWipeDisk>
          <CreatePartitions>
            <!-- Data partition -->
            <CreatePartition wcm:action="add">
              <Order>1</Order>
              <Type>Primary</Type>
              <Extend>true</Extend>
            </CreatePartition>
          </CreatePartitions>
          <ModifyPartitions>
            <!-- Data partition -->
            <ModifyPartition wcm:action="add">
              <Order>1</Order>
              <PartitionID>1</PartitionID>
              <Label>Data</Label>
              <Letter>D</Letter>
              <Format>NTFS</Format>
            </ModifyPartition>
          </ModifyPartitions>
        </Disk>

Then I added the FolderLocations section to the Microsoft-Windows-Shell-Setup component under the <settings pass="oobeSystem"> section:

  <settings pass="oobeSystem">
    ... other components ...
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
      <FolderLocations>
        <ProfilesDirectory>D:\Users</ProfilesDirectory>
      </FolderLocations>

This gets me a second virtual disk with the user folder on it. I added some files to the desktop and then stopped the container and deleted the windows virtual disk. When I restarted it ran through the install process again. Unfortunately it didn't automatically start the partitioning like it did on the first run but I just clicked Next and it did the re-install: image

And yay I have a freshly installed windows with the existing secondary virtual disk with the users folder on it. The part where this all falls down though is that the re-install has added a new folder for my user account instead of re-using my old one. I can fix this by changing the user profile directory in the registry and then restarting.

So if I can get the registry change to be part of the unattended answer files, clean up the extra user folders that get created and figure out why it doesn't automatically do the disk partitioning anymore then we should at least have a way to keep user data persistent between windows installs.

I'll keep testing and post if I figure anything else out.

harb88 avatar Dec 14 '24 10:12 harb88