Maximum PC - USA (2022-01)

(Maropa) #1

FOREIGN FILESYSTEMS


From the Linux side, your Windows C:
drive and everything in it is available at
/mnt/c and from the Windows side, you
can see your Linux filesystem(s) from
Explorer by following the Linux shortcut
(it has a penguin icon) below OneDrive,
This PC, Network, and whatever else.
While handy, you shouldn’t let Linux
programs do I/O heavy operations on
/mnt/c. Why not? Read on...
If you run the mount command, you’ll
see that /mnt/c uses some sort of
exotic Plan 9 (9p) filesystem to mount
a drvfs volume. You’ll also see that the

root Linux filesystem lives on its own
block device (/dev/sdc or such) and that
there are mount points for WSLg (the
helper distro that enables tools to run
seamlessly with graphics and audio).
In WSL 1, drvfs is used directly, which
means that performance between
Windows and Linux file systems was a
little more performant. WSL 2 ’s use of
a 9p server to wrangle these transfers
slows things down but also enables
more flexibility and security. For this
reason, WSL 1 will outperform WSL 2 at
‘across the boundary’ transfers.

So if you need to run, say, a database
in WSL but, for some reason, its files
must be visible in Windows, then you
should downgrade to WSL 1. It’s better
to try and keep heavy transfers within
the WSL bubble. It’s even possible to add
additional drives to your machine and
format them as Ext4 (or your favorite
Linux filesystem) from within WSL.
You won’t be able to see them from
the Windows side (at least not without
additional tooling), but transferring
large files or doing lots of random I/O
should be much swifter.

images, so you can use CUDA, PyTorch, and TensorFlow
to machine-learn your way to freedom.
Or you might want to try something else. One of the
best things about WSL 2 .0 is that it supports GUI tools
without any extra configuration. It even has its own
Wayland compositor. In the previous version, graphical
tools could be used but needed an X server (GWSL,
VcXsrv, or X 41 0) to be running on the Windows side.
Our favorite GUI tool is Microsoft Edge, and our
favorite type of humor is sarcasm. So if you wanted
to run the Linux edition of Microsoft’s browser in a
Microsoft-flavored version of Linux, you could go right
ahead and do:
$ sudoaptinstall software-properties-common apt-
transport-https wget
$ wget-q https://packages.microsoft.com/keys/
microsoft.asc -O- | sudo apt-key add -
$ sudo add-apt-repository “deb [arch=amd64] https://
packages.microsoft.com/repos/edge stable main”
$ sudo apt install microsoft-edge-dev
Now Edge should appear in the start menu, or you
can start it with a simple microsoft-edge.
In this way, you could also install such Redmondian
wonders as Microsoft Teams or Skype. Or perhaps
something that isn’t so Windows-centric. Popular open-
source programs are just that, so the likes of GIMP,
Blender, VLC et al all have official Windows equivalents.
If for some reason these don’t work well, then now
you have options. The Transmission BitTorrent client
is perhaps an exception—it has a Windows port, but
it’s described as an early preview. You may have your
own Windows torrent client preferences (uTorrent is
popular), but if not you can enjoy the solid reliability of
the Linux version. It’s just a matter of:
$ sudo apt install transmission
Visual Studio Code (or the VSCodium fork) is
becoming increasingly popular on Linux. And it’s fast
becoming the code editor of choice for Raspberry Pi
users. We can install the Linux version in much the
same way as we installed Edge above, but we can also
do something different.
Recent VS Code versions support the WSL-remote
extension, so you can install the Windows version (from
https://code.visualstudio.com) and then have easy
access to your WSL files.


For this to work ensure “Add to PATH” is checked
in the Select Additional Tasks dialog at the start of the
installation. Then from the Extensions marketplace,
search for Remote Development and install the
extension pack (which enables remoting to WSL,
Containers, or over SSH). According to the docs at
https://docs.microsoft.com/en-us/windows/wsl/
tutorials/wsl-vscode you should now be able to start VS
code from within WSL by opening the Ubuntu command
line and running code.. This didn’t work for us, but we
were able to use F1 to bring up the command palette in
VS Code and search for Remote-WSL. , which reveals
some of its many functions. These include being able to
open a folder in WSL, complete with its own Terminal.
If you run the top command within a freshly started
WSL 2 .0 instance, you’ll see there’s not much running—a
couple of init processes, Bash and Top itself, and not a
hint of bloat. This is a slight subterfuge because a lot
of the magic happens in an invisible service virtual
machine. This runs a containerized distro based on
Microsoft’s CBL Mariner Linux (developed for its Azure
cloud) which handles Wayland, X, PulseAudio and
beams it back into Windows via FreeRDP. Read more
about WSLg, at https://github.com/microsoft/wslg.

Having a whole
Marketplace
inside a code
editor isn’t
everyone’s
cup of tea,
but you’ll find
WSL extension
fortifying and
refreshing

JAN 2022 MAXIMUMPC 37

Free download pdf