Any attempt to open LINUX files using Windows tools may read-lock the opened files/folders, thereby stopping updates for your file contents. It invariably can result in files and folders becoming corrupted. Windows experts advise its customers to exercise extreme caution while attempting to create Linux files using Windows apps, tools, scripts, and consoles.
Creating or changing Linux files from Windows
If we dig a bit deeper into this subject and find why this phenomenon occurs in the first place, we’ll have our questions answered. Every Operating System has its file metadata, which differs from one OS to another. As a result, Windows file metadata is different from Linux file metadata and not recognized by Windows.
As a natural consequence, any effort to add or update Linux file metadata using Windows files would impose an unnecessary overhead on most Windows users who will not run WSL.
If you are not aware, WSL or Windows Subsystem for Linux (WSL) is a compatibility layer for running Linux binary executables natively on Windows 10. So, It’s the sole responsibility of WSL to write/update Linux file metadata for all the files under your Linux filesystem root (i.e.,/), storing the Linux metadata in each file’s NTFS extended attributes. In addition to the above, WSL also synthesizes pseudo metadata for most of the files in your Windows filesystem.
The problem occurs when a user uses a Windows app/tool to open, create or modify a file under your distro root (Linux filesystem containing Linux files or any of the files and folders under %localappdata%\lxss). Since Windows application/program was used to create the file, it won’t have any Linux file metadata (e.g., permissions, owner, access/update timestamps, etc.). Therefore, for a Linux system configured only to receive Linux file metadata, the file may have some metadata but will appear as empty, corrupting contents in the file.
To avoid such instances of misfortune, follow these two rules to avoid losing files or corrupting your data,
- First, never try to store files in your Windows filesystem you want to modify using Windows tools AND Linux tools.
- Second, DO NOT attempt to create/modify Linux files from Windows apps, tools, scripts, or consoles.
For more information, visit MSDN Blog.
Does Windows support Linux?
You can use WSL or Windows Subsystem for Linux to install any of the Linux Distro and then access Windows files as well. The Windows Subsystem for Linux lets developers run a GNU/Linux environment — including most command-line tools, utilities, and almost everything Linux can run.
Is WSL better than VM?
VMs are an excellent choice if you plan to use them in isolated or networked environments. The WSL command-line tool allows you to use Linux commands on your Windows system (to modify Windows files) easily.