Skip to content

windows subsystem for linux

list your installed distros

wsl -l

backup a distro

wsl --export DISTRO_NAME FILENAME.tar

restore a distro

wsl --import DISTRO_NAME INSTALL_LOCATION FILENAME.tar

mount and access other linux filesystems

to mount a disk, open a powershell window with administrator privileges

wsl --mount <DiskPath>

the mounted path will be available on wsl inside /mnt/wsl directory.

to list the available disks in Windows

wmic diskdrive list brief

the disks paths are available under the DeviceID columns, usually under the \\.\PHYSICALDRIVE0 format.

to unmount and detach the disk

wsl --unmount <Diskpath>

import any linux distribution to use with wsl

run your distro on podman

podman run -it centos:7 bash

export the container to a .tar file

podman export 8dfcc57ae00d > centos7.tar

on powershell, import the .tar file as a new distro

wsl --import CentOS D:\wslDistroStorage\CentOS .\centos7.tar