Ubuntu WSL on Windows 10 shows 2 x 256 GB drives though only one 256 GB drive is installed
I've installed Ubuntu on Windows 10 using WSL (Windows Subsystem for Linux).
When I run the lslbk
command, I see the following:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 256G 0 disk
sdb 8:16 0 256G 0 disk /
However, in Windows Disk Management, there is only one hard disk installed. I'm confused why the Ubuntu WSL shows the aforementioned output.
Both drives are virtual disks in WSL2, as WSL doesn't allow direct access to the underlying Windows host drive/hardware. WSL1's lsblk
just errors out, while WSL2 (which you are apparently using) at least makes an attempt to map the virtual disk to its proper Linux device.
/dev/sdb
, as can be seen in your lsblk
output, is your root filesystem for this particular WSL instance. If you were to start another instance (by installing a distribution or cloning your existing one), you would see a third drive (in all instances). You can also see it being "attached" through dmesg
.
With a default Ubuntu on WSL installation, the /dev/sdb
for the instance corresponds to the ext4.vhdx
file in your %userprofile%\AppData\Local\Packages\<distribution_package>\LocalState\
directory. If you create your own instances with wsl --import
, it's possible to place the file anywhere.
/dev/sda
is, I'm fairly certain, the swap drive (credit here). This drive is shared across all WSL instances. You can find this virtual disk in %temp%\swap.vhdx
. Although I don't recommend it, you can confirm this with:
cat /proc/swaps # shows that the swap file is "/swap/file"
sudo mkdir /mnt/tmpmount
sudo mount /dev/sda /mnt/tmpmount
ls /mnt/tmpmount # shows the "file" is the only thing on the drive
Under a typical Linux installation, this would be more apparent through the mount in /etc/fstab
, but this seems to be one of the things WSL handles through its own (bit-of-a-black-box) /init
.