Web Development on the Windows Subsystem for Linux
As a developer who has used Linux for web development for many years (starting with Fedora Core 5 back in the early 2000’s), I prefer to develop on a true LAMP stack. With the advent of WSL, that concept has become a lot easier to maintain if I also want the advantage of the Windows Desktop environment, which I prefer. However, I realized something recently that never occurred to me. Well, it probably occurred to me, but it didn’t bite me until now.
Over the past weekend, I decided I was tired of my Windows 11 system running sluggishly (or, whatever happens to Windows after a few months of steady use. Yeah, yeah. I hear you), so I bit the bullet and reset Windows 11, opting to “keep” my existing files. Honestly, I never did the research for what exactly that means (as in, looking at a fresh install vs a “reset”– like in a table comparison or something). And I don’t feel like looking at that detail right now because I never get anything accomplished, but I’m pretty sure it deletes the AppData
folder. So, when they say “keep your files”, it’s referring only to your C:\Users\username\Documents
and such. Also, in my experience after having been through this a few times already, any folders created in the root C:\ directory for example are left untouched as well.
At first the idea of “resetting” a system might be a prospect which causes anxiety. For good reason of course. The truth is, if you pay attention to what you’re doing and plan for the inevitable (system becoming too sluggish, virus, whatever), you’ve already got your critical files backed up. With the advent of Microsoft OneDrive, I’ve been keeping my Program Application Data in a folder inside of OneDrive, so when I do re-install my system (or, if I use my Windows 10 system, for example), not unlike the days of using a USB stick for “portable” apps and settings that we like to use everywhere, as long as you have an internet connection, you can rest assured that all of your important files and settings are going to be available for you wherever you go, and when you need to “reset” your Windows OS (resetting Windows is basically reinstalling the operating system, but it doesn’t delete everything, so much of what you have spent so much time configuring will remain there, if you plan ahead when you’re setting up your system).
Going back to the idea of what files and folders remain after a Windows reset, be sure to remember that the WSL file system will be deleted. Therefore, any web sites under development in the WSL environment will be gone, never to return. There is an option to make a copy of the WSL container, so it’s really a non-issue. Just don’t forget to make that copy, as I did. To back up the WSL folder, simple open a terminal as Administrator and type the following command wsl --export some_file_name.tar
and all of that stuff will be available for you to import into the new system when the reset is complete. Usually, I don’t forget to do that sort of thing, but I was tired and not thinking. Fortunately, I’m just angry about the configuration files. I didn’t have any valuable web development projects there, so I didn’t really lose anything. But heed this warning. Be sure to backup your WSL system periodically, or at least prior to doing a system reset!
Leave a Reply