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

moving Linux filesystem #449

Open
tycho01 opened this Issue May 28, 2016 · 160 comments

Comments

Projects
None yet
@tycho01

tycho01 commented May 28, 2016

I figured I was about to install a bunch of things on my shiny new Linux subsystem, then realized my SSD would soon run out of disk space at that rate. Hoping I could improvise a solution, I tried moving the folder C:\Users\USER\AppData\Local\lxss to my D: drive and creating a (hard) symlink to it from the original location. This backfired though, as I was no longer able to boot bash afterwards (nor after moving it back or disabling/re-enabling the feature), which resulted in either no response (if opened from the start menu) or with Error: 0x8007001f (if called from a command prompt).
I'd be glad to know if anyone has successfully managed to move their Linux subsystem to save SSD space.

@fragtion

This comment has been minimized.

Show comment
Hide comment
@fragtion

fragtion May 28, 2016

Same thing happened to me. Tried with junction first, then symlink

fragtion commented May 28, 2016

Same thing happened to me. Tried with junction first, then symlink

@benhillis benhillis added feature discussion and removed feature labels May 28, 2016

@dreyks

This comment has been minimized.

Show comment
Hide comment
@dreyks

dreyks May 29, 2016

This would be really nice, as I generally keep my system disk not so big

dreyks commented May 29, 2016

This would be really nice, as I generally keep my system disk not so big

@xrw

This comment has been minimized.

Show comment
Hide comment
@xrw

xrw Jun 3, 2016

Same issue. Hope it could move to disk D totally.

xrw commented Jun 3, 2016

Same issue. Hope it could move to disk D totally.

@fpqc

This comment has been minimized.

Show comment
Hide comment
@fpqc

fpqc Jun 4, 2016

Since directly editing the lxss user home from Windows software is not supported right now, why not have the lxss filesystem (outside of the /mnt stuff) just be a drive image, similar to the option in RDS in Windows Server 2012 R2 to make user home directories mountable images? That would cure the trouble of being able to move the folder around (since you could just point bash.exe to the image), and also would dissuade users from directly editing files in it (which breaks it).

I mean, users could even do this now by creating the \appdata\local\lxss folder, mounting a vhd to it, and then installing bash.exe directly.

fpqc commented Jun 4, 2016

Since directly editing the lxss user home from Windows software is not supported right now, why not have the lxss filesystem (outside of the /mnt stuff) just be a drive image, similar to the option in RDS in Windows Server 2012 R2 to make user home directories mountable images? That would cure the trouble of being able to move the folder around (since you could just point bash.exe to the image), and also would dissuade users from directly editing files in it (which breaks it).

I mean, users could even do this now by creating the \appdata\local\lxss folder, mounting a vhd to it, and then installing bash.exe directly.

@fpqc

This comment has been minimized.

Show comment
Hide comment
@fpqc

fpqc Jun 4, 2016

I uninstalled via lxrun /uninstall /full /y but recreated the folder %localappdata%\lxss, created a 20GB NTFS-formatted lxss.vhdx in diskmgmt on my side hdd (W:), and mounted it to %localappdata%\lxss with diskpart's mount command, then reinstalled WSL via bash.exe. So far, it's working.

I have a task set up right now to mount the vhdx on boot via the taskschd.msc running diskpart together with a script as System user, should continue to work after a reboot.

The script:
select vdisk file="W:\lxss.vhdx"
attach vdisk
`assign mount="C:\Users\fpqc\appdata\local\lxss"``

Also, another benefit of this is that you can easily back up your lxss install (if you are going to mess around and try something that might break it), simply by copying the vhdx.

fpqc commented Jun 4, 2016

I uninstalled via lxrun /uninstall /full /y but recreated the folder %localappdata%\lxss, created a 20GB NTFS-formatted lxss.vhdx in diskmgmt on my side hdd (W:), and mounted it to %localappdata%\lxss with diskpart's mount command, then reinstalled WSL via bash.exe. So far, it's working.

I have a task set up right now to mount the vhdx on boot via the taskschd.msc running diskpart together with a script as System user, should continue to work after a reboot.

The script:
select vdisk file="W:\lxss.vhdx"
attach vdisk
`assign mount="C:\Users\fpqc\appdata\local\lxss"``

Also, another benefit of this is that you can easily back up your lxss install (if you are going to mess around and try something that might break it), simply by copying the vhdx.

@tycho01

This comment has been minimized.

Show comment
Hide comment
@tycho01

tycho01 Jun 5, 2016

Great, thanks! Haven't tried yet but looks good. Marking as solved.

tycho01 commented Jun 5, 2016

Great, thanks! Haven't tried yet but looks good. Marking as solved.

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Jul 13, 2016

Since build 14388 the vhdx method did stop working. :(
I have been using an external bash.vhdx for days and attached to an empty %AppData%/Local/lxss folder WSL worked great.
Now when running bash.exe it says Error: 0x80070003

It seems now it tests the lxss folder and if it wasn't created by lxrun.exe then refuses to run.

I hope someone finds another way to export the WSL filesystem outside of the system partition. Compiling a project like Cyanogenmod13.0 (needs +60Gb of disk space) is just impossible for me without it.

onomatopellan commented Jul 13, 2016

Since build 14388 the vhdx method did stop working. :(
I have been using an external bash.vhdx for days and attached to an empty %AppData%/Local/lxss folder WSL worked great.
Now when running bash.exe it says Error: 0x80070003

It seems now it tests the lxss folder and if it wasn't created by lxrun.exe then refuses to run.

I hope someone finds another way to export the WSL filesystem outside of the system partition. Compiling a project like Cyanogenmod13.0 (needs +60Gb of disk space) is just impossible for me without it.

@fpqc

This comment has been minimized.

Show comment
Hide comment
@fpqc

fpqc Jul 13, 2016

ooh good catch man I'm not on 14388 yet but I hope they fix this.

fpqc commented Jul 13, 2016

ooh good catch man I'm not on 14388 yet but I hope they fix this.

@benhillis

This comment has been minimized.

Show comment
Hide comment
@benhillis

benhillis Jul 13, 2016

Member

Does Cyanogenmod13.0 compile without issues on DriveFs? (/mnt/d/...)

Member

benhillis commented Jul 13, 2016

Does Cyanogenmod13.0 compile without issues on DriveFs? (/mnt/d/...)

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Jul 13, 2016

@benhillis On build 14372 there were some problems on repo sync. #124

I'm going to try now on 14388.

Edit: Same error as 14372. On VolFs repo sync worked well though.

onomatopellan commented Jul 13, 2016

@benhillis On build 14372 there were some problems on repo sync. #124

I'm going to try now on 14388.

Edit: Same error as 14372. On VolFs repo sync worked well though.

@fpqc

This comment has been minimized.

Show comment
Hide comment
@fpqc

fpqc Jul 14, 2016

@benhillis eep my whole setup got nuked. I guess I will find a way to get my home folder and configs back >.>.

fpqc commented Jul 14, 2016

@benhillis eep my whole setup got nuked. I guess I will find a way to get my home folder and configs back >.>.

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Jul 17, 2016

I managed to move lxss folder to another partition in build 14390. It's not as elegant and flexible as the vhdx method but at least it works.
First uninstall your current WSL with lxrun /uninstall /full. Before installing WSL again you need to move %LocalAppData% folder to another partition and then create in the AppData folder a junction pointing to the new location. mklink /J C:\Users\onoma\AppData\Local E:\Local
After that lxrun /install will work like always.

%LocalAppData% is a folder always being used by the system so you need to move/copy it from "outside". I created another admin user and did it from there.

onomatopellan commented Jul 17, 2016

I managed to move lxss folder to another partition in build 14390. It's not as elegant and flexible as the vhdx method but at least it works.
First uninstall your current WSL with lxrun /uninstall /full. Before installing WSL again you need to move %LocalAppData% folder to another partition and then create in the AppData folder a junction pointing to the new location. mklink /J C:\Users\onoma\AppData\Local E:\Local
After that lxrun /install will work like always.

%LocalAppData% is a folder always being used by the system so you need to move/copy it from "outside". I created another admin user and did it from there.

@tycho01 tycho01 reopened this Jul 17, 2016

@tycho01

This comment has been minimized.

Show comment
Hide comment
@tycho01

tycho01 Jul 25, 2016

I haven't tested onomatopellan's new workaround yet, but I'd be inclined to consider this an open issue until Microsoft would start considering and supporting this use-case. Not every SSD-owner will have found this thread. :(

tycho01 commented Jul 25, 2016

I haven't tested onomatopellan's new workaround yet, but I'd be inclined to consider this an open issue until Microsoft would start considering and supporting this use-case. Not every SSD-owner will have found this thread. :(

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Jul 25, 2016

Yes, we need an option to move or install lxss folder in a desired location.

My method is working but it killed Edge browser. Every time I open Edge it crashes because it depends on LocalAppData folder. Also didn't survive to an upgrade to a newer build. Next step will be trying moving the entire AppData folder instead.

I'm trying to understand how lxss folder works. It can't be a junction anymore (thus VHD method wont' work) and only lxrun.exe can create it. Folder can't be copied or moved but can be renamed and like this I have various lxss folders (lxss.xenial, lxss.trusty, lxss.base) with different environments. To change from trusty to xenial I just have to rename lxss.xenial to lxss and it works. So the special attributes of WSL files are conserved in their original lxss folders. And that's what I can't understand. What makes this folder special? There are no reparse points, its attributes are just hidden and system, there aren't alternate data streams either... so where is the special info stored?

onomatopellan commented Jul 25, 2016

Yes, we need an option to move or install lxss folder in a desired location.

My method is working but it killed Edge browser. Every time I open Edge it crashes because it depends on LocalAppData folder. Also didn't survive to an upgrade to a newer build. Next step will be trying moving the entire AppData folder instead.

I'm trying to understand how lxss folder works. It can't be a junction anymore (thus VHD method wont' work) and only lxrun.exe can create it. Folder can't be copied or moved but can be renamed and like this I have various lxss folders (lxss.xenial, lxss.trusty, lxss.base) with different environments. To change from trusty to xenial I just have to rename lxss.xenial to lxss and it works. So the special attributes of WSL files are conserved in their original lxss folders. And that's what I can't understand. What makes this folder special? There are no reparse points, its attributes are just hidden and system, there aren't alternate data streams either... so where is the special info stored?

@benhillis

This comment has been minimized.

Show comment
Hide comment
@benhillis

benhillis Jul 25, 2016

Member

I feel your pain as a 100 GB SSD user. I've kicked of a thread with some of the developers to think about how we can support this Post Windows 10 Anniversary Update.

Just so I have the full story, is the install location the problem or would creating a separate VolFs mount on a different volume serve your purpose? Apt packages etc would still end up on your main OS volume but you could use all the features of VolFs on a larger drive.

Member

benhillis commented Jul 25, 2016

I feel your pain as a 100 GB SSD user. I've kicked of a thread with some of the developers to think about how we can support this Post Windows 10 Anniversary Update.

Just so I have the full story, is the install location the problem or would creating a separate VolFs mount on a different volume serve your purpose? Apt packages etc would still end up on your main OS volume but you could use all the features of VolFs on a larger drive.

@tycho01

This comment has been minimized.

Show comment
Hide comment
@tycho01

tycho01 Jul 25, 2016

Hm. I think I could definitely fill some GB just from installing things, so going by that, the ability to allow having the whole thing off the SSD would be nice. I dunno what VoIF stands for though!

tycho01 commented Jul 25, 2016

Hm. I think I could definitely fill some GB just from installing things, so going by that, the ability to allow having the whole thing off the SSD would be nice. I dunno what VoIF stands for though!

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Jul 25, 2016

Great to hear you are considering this. I'd vote for an entire different install location. And if it was possible to install on a VHDX file it would be the best. Being able to backup an entire WSL environment so easily has been the best feature until build 14388 was released.

All that said as second option mounting VolFs folders on external partitions sounds sweet.

@tycho01 VolFs folders are the / and /home type folders and have linux-like attributes. DrvFs are the /mnt/* folders.

onomatopellan commented Jul 25, 2016

Great to hear you are considering this. I'd vote for an entire different install location. And if it was possible to install on a VHDX file it would be the best. Being able to backup an entire WSL environment so easily has been the best feature until build 14388 was released.

All that said as second option mounting VolFs folders on external partitions sounds sweet.

@tycho01 VolFs folders are the / and /home type folders and have linux-like attributes. DrvFs are the /mnt/* folders.

@fpqc

This comment has been minimized.

Show comment
Hide comment
@fpqc

fpqc Jul 25, 2016

@benhillis Actually, the earlier workaround solution of installing on a vhdx was working really well for me (and apparently a bunch of other people). Not really sure how it broke, but what would be ideal is to fix things so we can do that again (maybe automate it?) as well as allow us to create other vhdx files "formatted" for VolFS use that can be mounted.

fpqc commented Jul 25, 2016

@benhillis Actually, the earlier workaround solution of installing on a vhdx was working really well for me (and apparently a bunch of other people). Not really sure how it broke, but what would be ideal is to fix things so we can do that again (maybe automate it?) as well as allow us to create other vhdx files "formatted" for VolFS use that can be mounted.

@rayncc

This comment has been minimized.

Show comment
Hide comment
@rayncc

rayncc Aug 4, 2016

I'll vote for this option.
The lxss is killing my disk space :(

rayncc commented Aug 4, 2016

I'll vote for this option.
The lxss is killing my disk space :(

@zidongtuili

This comment has been minimized.

Show comment
Hide comment
@zidongtuili

zidongtuili Aug 5, 2016

@onomatopellan

I might be wrong, but maybe you can consider just create lxss folder under appdata\Local and only link this folder to another directory, so that Edge won't crash? I'm not sure if you link the whole local folder because the bash system requires, or you didn't have the lxss folder before creating the subsystem? (Sorry I just realised you meant that lxss can't be linked? I just tried and it said cannot create link when file already exists)

Although vhdx is more elegant, mklink seems to be faster right? My poor table has very slow disk i/o (I'm using a sd card, which is slow and sometimes windows just can't detect it, maybe someone can help me make it stable), and I do hope I can have a faster way.

After reading this post, I'm considering moving Office 365 (or maybe the whole program files) :) No idea why Edge crashed actually, I thought mklink worked the same way as linux and Edge should put its files wherever the address is, regardless the actual location.

zidongtuili commented Aug 5, 2016

@onomatopellan

I might be wrong, but maybe you can consider just create lxss folder under appdata\Local and only link this folder to another directory, so that Edge won't crash? I'm not sure if you link the whole local folder because the bash system requires, or you didn't have the lxss folder before creating the subsystem? (Sorry I just realised you meant that lxss can't be linked? I just tried and it said cannot create link when file already exists)

Although vhdx is more elegant, mklink seems to be faster right? My poor table has very slow disk i/o (I'm using a sd card, which is slow and sometimes windows just can't detect it, maybe someone can help me make it stable), and I do hope I can have a faster way.

After reading this post, I'm considering moving Office 365 (or maybe the whole program files) :) No idea why Edge crashed actually, I thought mklink worked the same way as linux and Edge should put its files wherever the address is, regardless the actual location.

@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Aug 6, 2016

@zidongtuili Exactly, lxss can't be a link anymore. That's why I tried moving and linking Local folder. I think Edge crashed because the method I used to copy the LocalAppData folder wasn't the best. I changed the way I copy the "Local" folder now (I use robocopy after booting to command prompt) and I had better luck. Edge works like it should and WSL installs without problem. Now I only need to know if the link will survive to a new build install. I'll try with next Insider build.

onomatopellan commented Aug 6, 2016

@zidongtuili Exactly, lxss can't be a link anymore. That's why I tried moving and linking Local folder. I think Edge crashed because the method I used to copy the LocalAppData folder wasn't the best. I changed the way I copy the "Local" folder now (I use robocopy after booting to command prompt) and I had better luck. Edge works like it should and WSL installs without problem. Now I only need to know if the link will survive to a new build install. I'll try with next Insider build.

@utick

This comment has been minimized.

Show comment
Hide comment
@utick

utick Aug 7, 2016

@onomatopellan I tried your solution, use another admin user and robocopy the Local folder to another parition, then made a junction link. Everything seems ok after reboot and I installed WSL successfully. But one day later the system goes wrong. All of the ump apps disapeared and the setting app crashed.
The command i used:

robocopy C:\Users\XXX\AppData\Local D:\Local /e /xj /copyall
mklink /j "C:\Users\XXX\AppData\Local" "D:\Local"

utick commented Aug 7, 2016

@onomatopellan I tried your solution, use another admin user and robocopy the Local folder to another parition, then made a junction link. Everything seems ok after reboot and I installed WSL successfully. But one day later the system goes wrong. All of the ump apps disapeared and the setting app crashed.
The command i used:

robocopy C:\Users\XXX\AppData\Local D:\Local /e /xj /copyall
mklink /j "C:\Users\XXX\AppData\Local" "D:\Local"
@onomatopellan

This comment has been minimized.

Show comment
Hide comment
@onomatopellan

onomatopellan Aug 7, 2016

@utick Is that user a Local account or a Microsoft Account? It's weird everything did work and suddenly didn't. Sounds like if Windows changed the drive letter where you stored the Local folder. Is that a fixed partition or a removable one? It also seems you used the old method, creating another user and copying from there in desktop. That method gave me trouble so now I use native Command Prompt.

  • Create a new admin local account for testing. Let's call it Test for example.
  • Login to Test and see which drive will store the Local folder. In my case is E:
  • Now restart to Advanced Startup (Shutdown button -> Restart with SHIFT key pressed)
  • Select Troubleshoot -> Advanced Options -> Command Prompt.
  • Login to Test and a command prompt window will appear. In this environment drive letters could have changed so we need to know which one is the windows partition and which one is the E: where we want to copy Local folder.
  • Type diskpart and then list volume In my case the windows partition is D: and the other partition here is F:
  • Type exit to exit from Diskpart. After this type:
  • mkdir F:\Local
  • cd D:\Users\Test\AppData
  • robocopy Local F:\Local /E /COPYALL Make sure there are no errors.
  • rename Local Local.old
  • mklink /J Local E:\Local This is important, the symlink needs to point to the drive letter you saw on the Desktop, nor the one you see on command prompt.
  • exit
    now Continue Windows 10 restart and login to Test and everything should work like always.

EDIT: I forgot something important. After this trick lxrun.exe cant create a new user because it can't access Temp folder. Open an admin CMD and type SET TEMP=E:\Local\Temp pointing to the new Temp location. After that lxrun /install to begin the bash install.

onomatopellan commented Aug 7, 2016

@utick Is that user a Local account or a Microsoft Account? It's weird everything did work and suddenly didn't. Sounds like if Windows changed the drive letter where you stored the Local folder. Is that a fixed partition or a removable one? It also seems you used the old method, creating another user and copying from there in desktop. That method gave me trouble so now I use native Command Prompt.

  • Create a new admin local account for testing. Let's call it Test for example.
  • Login to Test and see which drive will store the Local folder. In my case is E:
  • Now restart to Advanced Startup (Shutdown button -> Restart with SHIFT key pressed)
  • Select Troubleshoot -> Advanced Options -> Command Prompt.
  • Login to Test and a command prompt window will appear. In this environment drive letters could have changed so we need to know which one is the windows partition and which one is the E: where we want to copy Local folder.
  • Type diskpart and then list volume In my case the windows partition is D: and the other partition here is F:
  • Type exit to exit from Diskpart. After this type:
  • mkdir F:\Local
  • cd D:\Users\Test\AppData
  • robocopy Local F:\Local /E /COPYALL Make sure there are no errors.
  • rename Local Local.old
  • mklink /J Local E:\Local This is important, the symlink needs to point to the drive letter you saw on the Desktop, nor the one you see on command prompt.
  • exit
    now Continue Windows 10 restart and login to Test and everything should work like always.

EDIT: I forgot something important. After this trick lxrun.exe cant create a new user because it can't access Temp folder. Open an admin CMD and type SET TEMP=E:\Local\Temp pointing to the new Temp location. After that lxrun /install to begin the bash install.

@lewisdonofrio

This comment has been minimized.

Show comment
Hide comment
@lewisdonofrio

lewisdonofrio Mar 27, 2018

@DarthSpock welcome to try mine (to proof the documented steps) its 18.04 ubuntu with xfce4 from http://www.tinyurl.com/donofrio1804 (skip unneeded login)

Oh and I'm guessing but I believe ubuntu.exe doesn't care what volume you run it from, currently the rootfs file is in my downloads directory lol

lewisdonofrio commented Mar 27, 2018

@DarthSpock welcome to try mine (to proof the documented steps) its 18.04 ubuntu with xfce4 from http://www.tinyurl.com/donofrio1804 (skip unneeded login)

Oh and I'm guessing but I believe ubuntu.exe doesn't care what volume you run it from, currently the rootfs file is in my downloads directory lol

@Plinpod

This comment has been minimized.

Show comment
Hide comment
@Plinpod

Plinpod Jun 12, 2018

Is there any update on this? I was hoping to be able to install the Linux filesystem on Dropbox or OneDrive to be able to use it between multiple machines.

Plinpod commented Jun 12, 2018

Is there any update on this? I was hoping to be able to install the Linux filesystem on Dropbox or OneDrive to be able to use it between multiple machines.

@DDoSolitary

This comment has been minimized.

Show comment
Hide comment
@DDoSolitary

DDoSolitary Jun 12, 2018

@Plinpod I don't think it's possible because the filesystem require NTFS extended attributes to work, which the cloud drives apparently don't support.

DDoSolitary commented Jun 12, 2018

@Plinpod I don't think it's possible because the filesystem require NTFS extended attributes to work, which the cloud drives apparently don't support.

@Biswa96

This comment has been minimized.

Show comment
Hide comment
@Biswa96

Biswa96 Jun 12, 2018

There is something in wslconfig.exe in build 17686 about moving/upgrading filesystem. But it's not documented.

Biswa96 commented Jun 12, 2018

There is something in wslconfig.exe in build 17686 about moving/upgrading filesystem. But it's not documented.

@Plinpod

This comment has been minimized.

Show comment
Hide comment
@Plinpod

Plinpod Jun 12, 2018

@DDoSolitary Do you know of any solution for portability? I wanted to setup WSL as a development environment and be able to use it across different computers easily.

@Biswa96 Thanks, I'll keep an eye on it.

Plinpod commented Jun 12, 2018

@DDoSolitary Do you know of any solution for portability? I wanted to setup WSL as a development environment and be able to use it across different computers easily.

@Biswa96 Thanks, I'll keep an eye on it.

@DDoSolitary

This comment has been minimized.

Show comment
Hide comment
@DDoSolitary

DDoSolitary Jun 12, 2018

@Plinpod If you want the whole filesystem synced, the best way is using a Linux VPS.

DDoSolitary commented Jun 12, 2018

@Plinpod If you want the whole filesystem synced, the best way is using a Linux VPS.

@rasit

This comment has been minimized.

Show comment
Hide comment
@rasit

rasit Jun 12, 2018

@Biswa96 : The whole thread is about the lack of support to move WSL installations to non-system (not C) drives. Do you have a suggestion for that?

rasit commented Jun 12, 2018

@Biswa96 : The whole thread is about the lack of support to move WSL installations to non-system (not C) drives. Do you have a suggestion for that?

@DarthSpock

This comment has been minimized.

Show comment
Hide comment
@DarthSpock

DarthSpock Jun 12, 2018

@rasit You can use Biswa's project or DDoSolitary's project or even the official Microsoft project for building your own distro. Each of these will allow you to install to a drive other than C:\

There is something in wslconfig.exe in build 17686 about moving/upgrading filesystem

@Biswa96 Does this functionality work and if so, have you reversed it?

DarthSpock commented Jun 12, 2018

@rasit You can use Biswa's project or DDoSolitary's project or even the official Microsoft project for building your own distro. Each of these will allow you to install to a drive other than C:\

There is something in wslconfig.exe in build 17686 about moving/upgrading filesystem

@Biswa96 Does this functionality work and if so, have you reversed it?

@Plinpod

This comment has been minimized.

Show comment
Hide comment
@Plinpod

Plinpod Jun 12, 2018

@Biswa96 Installing WSL on the other systems wouldn't be an issue however since the purpose of this for me is to run a development environment I want a way for all the WSL installs to be in sync with each other so when I work on one I don't have to go over to the rest and make all the same changes. Installing in another folder would be a possible solution for me however if there was a way to do it.

@DDoSolitary My current solution is actually using a VPS but I wanted to try WSL to get over a few development hurdles and streamline my dev process. I may try your project and see if I can get it to work for my purposes.

Plinpod commented Jun 12, 2018

@Biswa96 Installing WSL on the other systems wouldn't be an issue however since the purpose of this for me is to run a development environment I want a way for all the WSL installs to be in sync with each other so when I work on one I don't have to go over to the rest and make all the same changes. Installing in another folder would be a possible solution for me however if there was a way to do it.

@DDoSolitary My current solution is actually using a VPS but I wanted to try WSL to get over a few development hurdles and streamline my dev process. I may try your project and see if I can get it to work for my purposes.

@DDoSolitary

This comment has been minimized.

Show comment
Hide comment
@DDoSolitary

DDoSolitary Jun 13, 2018

@Plinpod Then why not install the filesystem to a USB stick :)

DDoSolitary commented Jun 13, 2018

@Plinpod Then why not install the filesystem to a USB stick :)

@Plinpod

This comment has been minimized.

Show comment
Hide comment
@Plinpod

Plinpod Jun 13, 2018

@DDoSolitary I could use your project to do that or is that possible out of the box?

Plinpod commented Jun 13, 2018

@DDoSolitary I could use your project to do that or is that possible out of the box?

@DDoSolitary

This comment has been minimized.

Show comment
Hide comment
@DDoSolitary

DDoSolitary Jun 13, 2018

@Plinpod Microsoft doesn't provide that feature out of the box, but both my project and @Biswa96's can work on USB sticks.

DDoSolitary commented Jun 13, 2018

@Plinpod Microsoft doesn't provide that feature out of the box, but both my project and @Biswa96's can work on USB sticks.

@gj86

This comment has been minimized.

Show comment
Hide comment
@gj86

gj86 Aug 24, 2018

To move my wsl location I followed this link: https://docs.microsoft.com/en-us/windows/wsl/install-on-server

But instead of choosing a location on system drive (C:) I used a VHDX mounted to %LocalAppData%\lxss and installed Ubuntu 18.04 distribution to %LocalAppData%\lxss\Ubuntu-18.04. Installing directly to lxss folder doesn't seem to work.

I used the official Ubuntu 18.04 distribution from Microsoft.
Forgot to mention, I'm running Windows 10 x64 Version 1803 (Build 17134.228)

gj86 commented Aug 24, 2018

To move my wsl location I followed this link: https://docs.microsoft.com/en-us/windows/wsl/install-on-server

But instead of choosing a location on system drive (C:) I used a VHDX mounted to %LocalAppData%\lxss and installed Ubuntu 18.04 distribution to %LocalAppData%\lxss\Ubuntu-18.04. Installing directly to lxss folder doesn't seem to work.

I used the official Ubuntu 18.04 distribution from Microsoft.
Forgot to mention, I'm running Windows 10 x64 Version 1803 (Build 17134.228)

@bitcrazed

This comment has been minimized.

Show comment
Hide comment
@bitcrazed

bitcrazed Aug 24, 2018

Collaborator

@gj86 Why mount your VHDX to your user's app data folder? I don't see any benefit to mounting a VHDX to %LocalAppData%\lxss\ - this was where we put the distro when WSL was in beta - it's no longer used for store apps.

Also, distros are provided by distro owners, not Microsoft - we just deliver the bits - we don't distribute the distros.

Also note that if you choose to extract and install your distro as per the server instructions, you forego any servicing and several of the benefits of the Microsoft Store infrastructure. And when we do eventually ship a supported way to move your distros, we won't be able to move and manage your manually extracted distros.

If that works for you, then go ahead, but do be aware of the above when considering manually extracting distros.

Collaborator

bitcrazed commented Aug 24, 2018

@gj86 Why mount your VHDX to your user's app data folder? I don't see any benefit to mounting a VHDX to %LocalAppData%\lxss\ - this was where we put the distro when WSL was in beta - it's no longer used for store apps.

Also, distros are provided by distro owners, not Microsoft - we just deliver the bits - we don't distribute the distros.

Also note that if you choose to extract and install your distro as per the server instructions, you forego any servicing and several of the benefits of the Microsoft Store infrastructure. And when we do eventually ship a supported way to move your distros, we won't be able to move and manage your manually extracted distros.

If that works for you, then go ahead, but do be aware of the above when considering manually extracting distros.

@lewisdonofrio

This comment has been minimized.

Show comment
Hide comment
@lewisdonofrio

lewisdonofrio Aug 24, 2018

I keep my install within the %userprofilepath%/Downloads/rootfs (I run ubuntu 18.04 and our corporation/education doesn't allow the ms-store or onedrive apps (actuallt removes them before the user gets the desktop - http://www.tinyurl.com/donofrioworkdesk) anyways I figure the wsl is per user based or?

lewisdonofrio commented Aug 24, 2018

I keep my install within the %userprofilepath%/Downloads/rootfs (I run ubuntu 18.04 and our corporation/education doesn't allow the ms-store or onedrive apps (actuallt removes them before the user gets the desktop - http://www.tinyurl.com/donofrioworkdesk) anyways I figure the wsl is per user based or?

@lewisdonofrio

This comment has been minimized.

Show comment
Hide comment
@lewisdonofrio

lewisdonofrio Aug 24, 2018

Looks like this method https://github.com/zloeber/WindowsSetupScripts/tree/master/Scripts does what you need (moving the install dir to where ever you want, I'm going to try to refit my steps into this I believe....oneday he uses choco like I do so "I got that going for me"

lewisdonofrio commented Aug 24, 2018

Looks like this method https://github.com/zloeber/WindowsSetupScripts/tree/master/Scripts does what you need (moving the install dir to where ever you want, I'm going to try to refit my steps into this I believe....oneday he uses choco like I do so "I got that going for me"

@gj86

This comment has been minimized.

Show comment
Hide comment
@gj86

gj86 Aug 24, 2018

@bitcrazed Actually there is one benefit that I needed, was to move the rootfs location from system drive to a much larger drive. I need the space as my system drive is ~120GB.

About the distribution what I meant was I downloaded official Ubuntu 18.04 package linked in the tutorial from Microsoft servers. Which kind of implies you are distributing them (Also distros are available from Microsoft Store.).

However, the point of my post was if anyone looking to move the WSL file location there is possibility, unofficial albeit. Which also implies foregoing any official support.

Thank you for the amazing work on WSL. Which makes it a viable development environment and not just for scripting with Bash.

gj86 commented Aug 24, 2018

@bitcrazed Actually there is one benefit that I needed, was to move the rootfs location from system drive to a much larger drive. I need the space as my system drive is ~120GB.

About the distribution what I meant was I downloaded official Ubuntu 18.04 package linked in the tutorial from Microsoft servers. Which kind of implies you are distributing them (Also distros are available from Microsoft Store.).

However, the point of my post was if anyone looking to move the WSL file location there is possibility, unofficial albeit. Which also implies foregoing any official support.

Thank you for the amazing work on WSL. Which makes it a viable development environment and not just for scripting with Bash.

@bitcrazed

This comment has been minimized.

Show comment
Hide comment
@bitcrazed

bitcrazed Aug 24, 2018

Collaborator

I hear ya re. size.

But no - the distro pacakges we provide for manual download are still created and published by their creators - Canonical, Debian, etc. The APPX files are, in fact, the exact same files that are downloaded when you download via the Microsoft Store app itself - they just arrive via a different download mechanism. In both the manual download and Store app download scenarios - Microsoft is simply the delivery agent - we're simply piping bits from our servers onto your machine (at your request). The files themselves are not ours - they're created and owned by the distro vendors.

No, thank YOU (all) for using WSL, supporting us by filing and discussing issues, helping us diagnose problems, etc. We literally couldn't do this without your help!

Collaborator

bitcrazed commented Aug 24, 2018

I hear ya re. size.

But no - the distro pacakges we provide for manual download are still created and published by their creators - Canonical, Debian, etc. The APPX files are, in fact, the exact same files that are downloaded when you download via the Microsoft Store app itself - they just arrive via a different download mechanism. In both the manual download and Store app download scenarios - Microsoft is simply the delivery agent - we're simply piping bits from our servers onto your machine (at your request). The files themselves are not ours - they're created and owned by the distro vendors.

No, thank YOU (all) for using WSL, supporting us by filing and discussing issues, helping us diagnose problems, etc. We literally couldn't do this without your help!

@bitcrazed

This comment has been minimized.

Show comment
Hide comment
@bitcrazed

bitcrazed Aug 24, 2018

Collaborator

@lewisdonofrio NICE :)

Yes, WSL distros are installed kinda-per-user. In fact, the APPX itself is downloaded once per machine and unpacked in a fodler under c:\program files\.... But when run, the app runs using per-user data folders where, in WSL's case, your distros are extracted.

This way, multiple users can have their own private instance-data, but share the same (largely) immutable exe package. This works particularly well for large apps with small per-user data, but less well for small apps with large per-user data … like WSL.

Collaborator

bitcrazed commented Aug 24, 2018

@lewisdonofrio NICE :)

Yes, WSL distros are installed kinda-per-user. In fact, the APPX itself is downloaded once per machine and unpacked in a fodler under c:\program files\.... But when run, the app runs using per-user data folders where, in WSL's case, your distros are extracted.

This way, multiple users can have their own private instance-data, but share the same (largely) immutable exe package. This works particularly well for large apps with small per-user data, but less well for small apps with large per-user data … like WSL.

@lewisdonofrio

This comment has been minimized.

Show comment
Hide comment
@lewisdonofrio

lewisdonofrio Aug 24, 2018

@bitcrazed I used to use ubuntu on three desktop's and one hid using synergy but these days (down to two desktop dual monitor single hid with "Mouses without Boarders" there is no "VMWare Airwatch" client for linux as of yet. So I got Information Assurance to sign off on this WSL goodness and use W10 as a 15gb bootloader to usermode ubuntu xfce4 gui goodness.....

--Favor can you folks work on your own X11 for W10 so we get Directx accelerated video within DE as well :)

lewisdonofrio commented Aug 24, 2018

@bitcrazed I used to use ubuntu on three desktop's and one hid using synergy but these days (down to two desktop dual monitor single hid with "Mouses without Boarders" there is no "VMWare Airwatch" client for linux as of yet. So I got Information Assurance to sign off on this WSL goodness and use W10 as a 15gb bootloader to usermode ubuntu xfce4 gui goodness.....

--Favor can you folks work on your own X11 for W10 so we get Directx accelerated video within DE as well :)

@WolfFree

This comment has been minimized.

Show comment
Hide comment
@WolfFree

WolfFree Sep 22, 2018

I found the solution to opening Question.
It's a tool called LxRunOffline (https://github.com/DDoSolitary/LxRunOffline)
You can move WSL lxx installation directory C: to another drive(needs to be still NTFS).
(On different drives you have copy so you need to remove old files manually).
Create and restore backups from/to tar file.
Register exiting directories so can use this with different users and many more.
Short all the stuff Microsoft should have implemented in his LxRun tool from the beginning.
This works for me and still learn something new in the source.

WolfFree commented Sep 22, 2018

I found the solution to opening Question.
It's a tool called LxRunOffline (https://github.com/DDoSolitary/LxRunOffline)
You can move WSL lxx installation directory C: to another drive(needs to be still NTFS).
(On different drives you have copy so you need to remove old files manually).
Create and restore backups from/to tar file.
Register exiting directories so can use this with different users and many more.
Short all the stuff Microsoft should have implemented in his LxRun tool from the beginning.
This works for me and still learn something new in the source.

@DarthSpock

This comment has been minimized.

Show comment
Hide comment
@DarthSpock

DarthSpock Sep 22, 2018

@WolfFree Before complaining about Microsoft implementations, you should of done a little more investigation. While we'd love for Store installed distros to be moved and still waiting for that reality, we do have the ability to install to other drives thanks to Microsoft: https://github.com/Microsoft/WSL-distrolauncher. This method is the official supported method of installing distro's without going through the Store.

DarthSpock commented Sep 22, 2018

@WolfFree Before complaining about Microsoft implementations, you should of done a little more investigation. While we'd love for Store installed distros to be moved and still waiting for that reality, we do have the ability to install to other drives thanks to Microsoft: https://github.com/Microsoft/WSL-distrolauncher. This method is the official supported method of installing distro's without going through the Store.

@therealkenc

This comment has been minimized.

Show comment
Hide comment
@therealkenc

therealkenc Sep 22, 2018

Collaborator

Short all the stuff Microsoft should have implemented in his LxRun tool from the beginning.

I suppose it is possible that the devs at MSFT are simultaneously (a) capable of implementing an entire Linux syscall emulation layer while (b) are oblivious to the fact you can install WSL on another drive with a static tar and a tiny powershell script (or equivalently any of the many LxRun******* related projects).

But... you might want to consider the likelihood of that being the case. And in the off chance it isn't the case that the MSFT devs are oblivious, you might want to reconsider the veracity of any conclusions drawn from false premises. Please use the online communities of those projects to report any problems you may have with their product.

Collaborator

therealkenc commented Sep 22, 2018

Short all the stuff Microsoft should have implemented in his LxRun tool from the beginning.

I suppose it is possible that the devs at MSFT are simultaneously (a) capable of implementing an entire Linux syscall emulation layer while (b) are oblivious to the fact you can install WSL on another drive with a static tar and a tiny powershell script (or equivalently any of the many LxRun******* related projects).

But... you might want to consider the likelihood of that being the case. And in the off chance it isn't the case that the MSFT devs are oblivious, you might want to reconsider the veracity of any conclusions drawn from false premises. Please use the online communities of those projects to report any problems you may have with their product.

@WolfFree

This comment has been minimized.

Show comment
Hide comment
@WolfFree

WolfFree Sep 23, 2018

@therealkenc
Sorry it was only just a personal comment. I just wanted to show how much I like the LxRunOffline tool I found. Like in opening post I had my frustration with the installation in %userprofile%\appdata\local\lxss (about 2 years ago). I couldn't use junctions. I searched and searched and didn't found any solution to change the path. And the comment was for what time. Now with this tool I can resuse my old lxss installations.
@DarthSpock your right I didn't make much research recently, I found this tool and wanted to share this information. But thanks link the official way.

Ok maybe comment is a little misleading, but would it have been so hard to have something like lxrun /install /dir in the beginning. I know we have now many other methods including store and lxrun isn't the official way anymore. So sorry I didn't wanted to offend anyone.

WolfFree commented Sep 23, 2018

@therealkenc
Sorry it was only just a personal comment. I just wanted to show how much I like the LxRunOffline tool I found. Like in opening post I had my frustration with the installation in %userprofile%\appdata\local\lxss (about 2 years ago). I couldn't use junctions. I searched and searched and didn't found any solution to change the path. And the comment was for what time. Now with this tool I can resuse my old lxss installations.
@DarthSpock your right I didn't make much research recently, I found this tool and wanted to share this information. But thanks link the official way.

Ok maybe comment is a little misleading, but would it have been so hard to have something like lxrun /install /dir in the beginning. I know we have now many other methods including store and lxrun isn't the official way anymore. So sorry I didn't wanted to offend anyone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment