Future-proof your skills with Linux, Python, vim & git as I share with you the most timeless and love-worthy tools in tech through my two great projects that work great together.

Share Folder Between Windows, WSL Linux, Container and Home Cloud

As an IT professional, I'm setting up a shared ~/data folder across four different locations: my laptop's main Windows system, a Linux system running under WSL2, an LXD Linux Container hosted under WSL2, and an LXD Container hosted on a separate machine. I'm mapping a network drive from my laptop's Windows system, mounting a drive from the Linux system, and adding a device to the LXD Linux Container. Follow my journey as I set up this complex shared folder

Setting up a Complex Shared Folder Across Windows, WSL2, LXD Containers, and a Home Cloud

By Michael Levin

Sunday, July 31, 2022

Share Folder Windows Linux Wsl Container Cloud

For my next trick, I really have to nail down and document how I get that ~/data directory to be in common across:

In situations like this when you want to share files freely between systems there are lots of choices. Increasingly copying stuff up to and down from Github is becoming the easiest choice, but that’s stupid because of all the extra delay and overhead. We have the perfect interface for moving files around, and that’s just copying files between drives. We should continue to enjoy that simple interface even with all these hosts, containers, cloud servers and whatnot.

In other words, all 4 of these locations that I currently have in play will have a ~/data location (except for Windows that uses letter-drives).

There’s a broader issue to address here. To make a ~/data folder accessible “everywhere”, it’s primary location shouldn’t really be on your laptop because when your laptop goes offline, anything else using it loses contact. So it’s time to talk about the QNAP NAS a bit more. It’s a good setup for letting the nice people know they need a 24x7 place to run code that isn’t their laptop and isn’t the cloud. That’s such a huge right of passage with tech capability. Some would call it a home server. Whatever. It’s just a place to run your containers that isn’t your laptop and isn’t the cloud. Call it a home server if you will.

Show the diagram from yesterday.

Let’s to through them one at a time.

Add shared folder on the main windows system (on laptop)

Add shared folder on a WSL2 instance of Linux (on laptop)

Add shared folder on LXD Linux Container hosted under WSL2 (on laptop)

lxc config device add Munchkin data disk source=/mnt/data path=/home/ubuntu/data

And after that command is done from the Linux host, the following command has to be done from inside a container Terminal session.

ln -s /mnt/data /home/ubuntu/data

Add shared folder LXD Container hosted on physically separate machine (qnap nas)