Microsoft: Don’t Edit Linux Files in Windows

Yeah, this is definitely inconvenient, but fortunately there are ways around it.

Microsoft warned all Windows 10 users who have installed the Windows Subsystem for Linux recently that they should not modify Linux files on Windows using apps, tools, scripts or other means. The Windows Subsystem for Linux (WSL) is part of Microsoft’s new Windows 10 operating system. It is not installed by default however and needs to be enabled by a user or administrator before it becomes available.

To enable Bash on Windows 10, a user would have to enable the Developer Mode first in the Settings app under Update & Security > For Developers. Once done, it is necessary to open the “Turn Windows features on or off” option in the classic Control Panel, and select Windows Subsystem for Linux to enable the feature.

Windows 10 downloads Bash then from the Store. Once that operation completes, you may fire it up by writing bash on the command prompt.

Don’t edit Linux files on Windows

linux files windows

Microsoft warns users of Windows 10 not to edit any Linux files that are part of the Linux subsystem using Windows apps, scripts, console commands or other means.

DO NOT, under ANY circumstances, create and/or modify Linux files using Windows apps, tools, scripts, consoles, etc.

The reason given is that creating or changing Linux files from Windows may result in data corruption or even a damaged Linux system.

Creating/changing Linux files from Windows will likely result in data corruption and/or damage your Linux environment requiring you to uninstall & reinstall your distro!

Microsoft refers to all Linux files that are part of WLS, and those are all stored under %localappdata%\lxss on the system drive.

The reason for this is that file metadata is handled differently on Linux than it is on Windows. Since WSL is stored in a NTFS folder, it is necessary that it “calculates and persists each Linux file’s metadata in its NTFS extended attributes”.

While WSL is capable of that, Windows apps, scripts, tools or programs are not. This means that create or modify events won’t store any Linux file metadata.

Files without proper metadata may not open, write or read at all because of this.

Microsoft’s solution is to store files that you need to use on Windows and Bash in separate directories.

When you access files on your Windows filesystem from within Bash, WSL honors the NT filesystem behaviors (e.g. case-insensitivity), permissions, etc. so you can easily access the same files using both Windows tools and Bash tools without having to copy files back and forth between filesystems.

Closing Words

While you might say that this is inconvenient if you use WSL regularly, it would be the same if you’d copy a NTFS file to a Linux partition, edit it, and copy it back.

Link to Original Content

Tags: , , , ,

Comments are closed.