Search code examples
windowsinstallationexternalwindows-subsystem-for-linuxsolid-state-drive

How can i install WSL2 on an external SSD?


I have a laptop with 1 TB HDD that has some performance issues while running some tests in WSL. The speed of running tests can be improved if i upgrade to SSD.

But doing that will require to do the entire OS setup to be done again from the beginning in SSD. Also, we have large amount of data in the existing HDD, which should be transferred to new SSD in that case.

Can i install the WSL2 in an SSD that can be connected externally to the laptop?

If yes, how can i do that in a proper way?

After that, will there be any problem running the tasks in it?

Will there be a problem in accessing the file system of HDD from WSL then?


Solution

  • Can i install the WSL2 in an SSD that can be connected externally to the laptop?

    I upgraded to WSL 2 today, and exported my distro (Ubuntu) with wsl --export to a .tar file on my D: drive before upgrading (to be safe, but also because I don't have so much space on my C: drive). So, after unregistering Ubuntu, I did the following:

    wsl --import Ubuntu d:\Ubuntu d:\Ubuntu_wsl_2020_09_30.tar
    

    This created a 16G .vhdx file in the path (D:\Ubuntu). I reset the default user and the level of the distro to 2 (per the upgrading instructions) and it is working fine on my D: drive. I should point out that my D: drive is internal, so I'm not sure how things work on an external drive.

    Will there be a problem in accessing the file system of HDD from WSL then?

    My C: drive shows up in /mnt/c/ as would be expected.

    I'm running Windows Version 10.0.19041 Build 19041.