Any attempt to open LINUX files using Windows tools may read-lock the opened files/folders, thereby stopping updates for your file contents. This invariably can result in files and folders becoming corrupted. As such, 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 own file meta data which differ from one OS to another. As a result, Windows file metadata is different from Linux file metadata, not recognized by Windows.
As a natural consequence of this, 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 which is 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.
- Tags: Linux