-
Notifications
You must be signed in to change notification settings - Fork 848
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
Comments
Same thing happened to me. Tried with junction first, then symlink |
This would be really nice, as I generally keep my system disk not so big |
Same issue. Hope it could move to disk D totally. |
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. |
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: 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. |
Great, thanks! Haven't tried yet but looks good. Marking as solved. |
Since build 14388 the vhdx method did stop working. :( 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. |
ooh good catch man I'm not on 14388 yet but I hope they fix this. |
Does Cyanogenmod13.0 compile without issues on DriveFs? (/mnt/d/...) |
@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. |
@benhillis eep my whole setup got nuked. I guess I will find a way to get my home folder and configs back >.>. |
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. %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. |
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. :( |
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? |
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. |
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! |
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. |
@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. |
I'll vote for this option. |
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 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 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.
|
@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.
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 |
Moving WSL distribution is somehow documented in Windows 10 insider build 18305. Use |
@Biswa96 I can confirm that this works in the latest 1903 update (build 18362.175). |
if you export then import, how do you get the binary shortcut (ie ubuntu.exe) back, and how do you get it to default to your user account instead of root? :-D |
@ericblade Hmm if you had the binary you could run: DISTRO_BIN.exe config --default-user NEW_USER But if the binary isn't installed properly after the restore that makes things a bit more complicated... |
That works great, thanks again, therealkenc. |
Simplest way i found to have the wsl on another partition:
|
Another way is by using powershell u can manually install the wsl distribution: Example for installing Ubuntu 16.04:
FIRST , you create the folder where we want to install the wsl distribution and cd into it |
@cbits06 Powershell method works with wsl 2! Thanks! |
@cbits06 Thanks you for the Powershell method. It's working perfectly here with WSL 2. |
#5044 was closed as a dupe but I'm reposting some of that info because I think there is a bit of a unique ask in that issue. tldr: the unique ask is to respect Windows 10 storage settings
|
2004 version link |
Make sure that you're checking out the directory structure as well once downloading the distro with the above method. It appears that the directory structure may have changed, it definitely did for Kali. Note: I used the For example I went to install Kali, using the above method, created a Open the directory or use the There is one that contains the main Kali.exe file:
This installed Kali, prompted me to enter my UNIX username and password, and successfully mounted Kali to my
sudo update && upgrade worked, bundled software worked, and everything is in the root directory of the distro. Now that I have it working, I'll probably uninstall and see if I can't simplify the directory structure a little more. None of the other Although I haven't tried it yet, the manifest details state that |
It's been a while now and there's still no officially-sanctioned way to base the WSL2 on a drive different than the system's C: . Are there any plans to add that feature at all? |
使用 LxRunOffline 可以简单的解决这个问题啊 |
我一直在使用 LxRunOffline 管理wsl,目前来看,使用 LxRunOffline 任然是解决这一问题的最好的方法 |
Still no updates on this one after 7 years?! Edit: The I think even if you guys have no intention to add a built-in option for this, you should at the very least document this particular workaround — there's also this PowerShell script that could do it for you. |
This issue was opened the same day Harambe died. This day, Roe has already been overturned and we are still trying to move our WSL's from C: to D: |
Can simply move installed distro to other location |
'simply', may as well just install linux as the main OS at this point |
LMAO |
You can now manage distribution locations through a new command line option:
Usage Example:
So Upvote 👍 on this comment if you agree this issue can now be closed. Or 👎 and leave a comment why it needs to remain open. |
Amazing! Great addition to WSL!
If you are using WSL and struggle and complain to edit registry, then literally what are you even doing? |
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 myD:
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 withError: 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.
The text was updated successfully, but these errors were encountered: