Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Works for me - thank you! #1

Closed
cgmartin opened this issue Jun 25, 2023 · 0 comments
Closed

Works for me - thank you! #1

cgmartin opened this issue Jun 25, 2023 · 0 comments

Comments

@cgmartin
Copy link

Thank you for sharing this. I found your repo by way of MicrosoftDocs/WSL#412

Just wanted to mention that it worked great for me, using latest commit 44613af.

Note: Before running the script I ran: wsl --shutdown

Script output:

PS C:\Users\anon\Src> .\Move-WSL2NewDrive.ps1
Which distro do you want to move?
1       Ubuntu-20.04          (Location: C:\Users\anon\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState)
2       docker-desktop        (Location: \\?\C:\Users\anon\AppData\Local\Docker\wsl\distro)
3       docker-desktop-data   (Location: \\?\C:\Users\anon\AppData\Local\Docker\wsl\data)
Chose wisely: 1
Enter the full parent path to the new distro (the path used will be: <path you enter>\<distro-name>): G:\WSL

Moving distro Ubuntu-20.04. Please save and close all work in WSL2 before proceeding, as a WSL shutdown is required to
move a distro.

Current Path:
C:\Users\anon\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState
New Path:     G:\WSL\Ubuntu-20.04

Would you like to proceed (Y/n)?
[Y] Yes  [N] No  [?] Help (default is "Y"):

It's cleanup time!

The original file now appears out of date, based on the last write times of the old and new VHDX files. Which means it
should be safe to delete the old VHDX file and free up some space.

Do you want to be 100% certain first!

Go to the original and new locations and compare the Date Modified time on the VHDX files. The time on the new file
should have a newer Date Modified time.

The old VHDX file should not have a Date Modified time much newer than around 6/25/2023 11:09:19 AM. That is roughly
the time when the script stopped wsl.

The original VHDX file is in:

C:\Users\anon\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState

The new VHDX file is in:

G:\WSL\Ubuntu-20.04

You can use "wsl --shutdown" followed by relaunching the WSL2 distro to force a change of the Date Modified time. The
new file time should change, the old file should remain the same.

If that's what happened then it should be safe to delete the old file.

Remove the original file?
[Y] Yes  [N] No  [?] Help (default is "Y"):
PS C:\Users\anon\Src>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant