Closed eggbean closed 2 years ago
I just realised that I cannot move them as the symlinks are /c
to /mnt/c
and not the other way around. If there were the other way around I wouldn't have this problem as the -P switch for pwd would ignore the symlinks.
Hello @eggbean,
Probably you run the docker installer in the past from pengwin-setup. So, let's do a quick check-up. Please run the following commands and send me the answer:
grep "root" /etc/wsl.conf
ll /mnt
df -h
With that information, I can give you the best alternative.
Regards, Carlos
$ grep "root" /etc/wsl.conf
root=/
$ ll /mnt
lrwxrwxrwx 1 3 root root 21 Feb 16:22 c -> /c
lrwxrwxrwx 1 3 root root 21 Feb 16:22 e -> /e
lrwxrwxrwx 1 3 root root 29 Jun 03:38 g -> /g
drwxr-xr-x 2 - root root 21 Feb 11:16 wsl
$ df -h
Filesystem Size Used Avail Use% Mounted on
none 4.9G 368M 4.5G 8% /wsl
drivers 208G 208G 636M 100% /usr/lib/wsl/drivers
none 4.9G 0 4.9G 0% /usr/lib/wsl/lib
/dev/sdc 251G 12G 227G 5% /
none 4.9G 280K 4.9G 1% /wslg
rootfs 4.9G 1.9M 4.9G 1% /init
none 4.9G 0 4.9G 0% /dev
none 4.9G 4.0K 4.9G 1% /run
none 4.9G 0 4.9G 0% /run/lock
none 4.9G 0 4.9G 0% /run/shm
none 4.9G 0 4.9G 0% /run/user
tmpfs 4.9G 0 4.9G 0% /sys/fs/cgroup
none 4.9G 72K 4.9G 1% /wslg/versions.txt
none 4.9G 72K 4.9G 1% /wslg/doc
drvfs 208G 208G 636M 100% /c
drvfs 30G 9.2G 21G 32% /e
/dev/sde 251G 7.6G 231G 4% /wsl/docker-desktop-data/isocache
none 4.9G 12K 4.9G 1% /wsl/docker-desktop/shared-sockets/host-services
/dev/sdd 1007G 60M 956G 1% /wsl/docker-desktop/docker-desktop-proxy
/dev/loop0 330M 330M 0 100% /wsl/docker-desktop/cli-tools
I think it's okay though, as this seems to be working fine and should work on all distros and WSL versions, I think?
shopt -s extglob
[[ $(realpath "${*:-.}") == /@(mnt|?)/* ]]
Hello,
Where the Windows drives are mounted is determined by the root property in wsl.conf:
[automount]
root=/
This is why your drives are mounted in / and your C: drive is on /c. This configuration is made by pengwin-setup, and it is required for mounting volumes from Windows in Docker for Windows via Hyper-V implementation. I see you have docker in WSL2, so this change is unnecessary. You can disable it by changing the root
value to /mnt
or entirely deleting the root
line. The symlinks are created for the scripts that assume that C: drive is permanently mounted in /mnt/c. If you make the change remember to terminate pengwin wsl --terminate wlinux
Hope it helps
Thank you for this information. I installed Docker Desktop through Pengwin setup (I think). I an unfamiliar with Docker Desktop but I know Docker on Linux. Is it still possible to use Docker Desktop GUI stuff with Docker on WSL/Linux or does it only use the Hyper-V virtualisation? It's confusing. Cheers.
Docker Desktop have two modes:
These lines:
/dev/sde 251G 7.6G 231G 4% /wsl/docker-desktop-data/isocache
none 4.9G 12K 4.9G 1% /wsl/docker-desktop/shared-sockets/host-services
/dev/sdd 1007G 60M 956G 1% /wsl/docker-desktop/docker-desktop-proxy
/dev/loop0 330M 330M 0 100% /wsl/docker-desktop/cli-tools
Make me think that you are using docker desktop with the WSL2 backend
Great, thanks.
I want to test whether the current working directory is NTFS or in the Linux partition, so using this:
However, this fails because of the symlinks. Should I just remove them? Or is there another way that I can make this test? It has to work quickly as it's for a wrapper script.