Giter Site home page Giter Site logo

lpcodes / moving-wsl-distribution-to-another-drive Goto Github PK

View Code? Open in Web Editor NEW
282.0 282.0 21.0 19 KB

This guide provides step-by-step instructions on how to move a Linux distribution installed on Windows Subsystem for Linux (WSL) to a different drive.

Home Page: https://lpcodes.github.io/Moving-WSL-Distribution-to-Another-Drive/

linux ubuntu windows-11 wsl

moving-wsl-distribution-to-another-drive's Introduction

moving-wsl-distribution-to-another-drive's People

Contributors

aarishshah avatar defkon1 avatar lpcodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

moving-wsl-distribution-to-another-drive's Issues

Set default distro

Hey,

Thank you for the tutorial.

At the end it's also useful to run wsl --setdefault DISTRO-NAME

So when you input wsl the next time, it starts and jumps you straight into the Ubuntu distro

before:

>wsl --list -v
  NAME                   STATE           VERSION
* docker-desktop         Running         2
  docker-desktop-data    Stopped         2
  Ubuntu                 Stopped         2

after:

>wsl --setdefault Ubuntu
The operation completed successfully.

>wsl --list -v
  NAME                   STATE           VERSION
* Ubuntu                 Stopped         2
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2

[Typo] Target paths differ in step 2

This is just a small typo. In step 2 in description D:\wsl\wsl_export path is specified, whilst in commands below it is D:\wsl_export only.

And thank you a lot for useful instruction.

[Issue] Unable to set default user

Description: ubuntu.exe config --default-user me this command is not working. It gives following error:
'ubuntu.exe' is not recognized as an internal or external command,
operable program or batch file.
There is a different way also, using wsl.conf file.

[user]
default=dsm

After importing the distribution, the wsl version became 1 instead of 2

After importing the distribution, the wsl version became 1 instead of 2

wsl -l -v
  NAME                   STATE           VERSION
* Debian                 Stopped         1
  docker-desktop         Stopped         2
  docker-desktop-data    Stopped         2

To fix it, run the command:
wsl --set-version Debian 2

It may be possible to explicitly specify which version of WSL to use when importing:

wsl --import Debian "D:\wsl\Debian" "D:\wsl_export\debian-ex.tar" --version 2

In my case with Ubuntu WSL2, I had to set --default-user to my user on the imported distro before launching.

Hello,

I saw this pop up on google and was very helpful and clear. Everything worked fine but for Ubuntu (not sure about other distros) I had to configure it to use my previous user from the WSL we exported/imported. If I didn't and launched the distro, then it would not show any of my files.

To do this it looks like so:

PS C:\Users\me> ubuntu.exe config --default-user me

Which I got from: https://stackoverflow.com/questions/63252225/is-this-the-correct-way-to-import-a-wsl-export-overwriting-default-installati

Appreciate this page again but because it pops up pretty far up on Google, I thought it might be good to include this info.

Step 5: Important step to mount back to the /home/<username>/ of the current existing wsl after moving

I have followed through your steps and figured out that the step 5 is extremely important to mount back the vhdx of wsl2 to what has been installed and configured in the /home/ for people who have has the setup for their linux distro, such as: oh-my-zsh, nvm, p10k, .etc

I think you should mark the step 5 is important for people who has had the current wsl2 on default C: drive and want to move to another drive, the step is necessary to bring back all set up. Thanks

Add setting the default distro as last step

In environments with multiple registered distros, the process of unregistering a distro configures the next one as new default automatically.

It could be useful to add a new optional step to re-set the moved distro as default:

wsl --setdefault Ubuntu-22.04

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.