Wednesday, March 29, 2023
HomeSoftware DevelopmentWSL2 can now mount Linux ext4 disks instantly

WSL2 can now mount Linux ext4 disks instantly



For those who’re on a model of Home windows 11 that’s construct 22000 or better, now you can use WSL to mount Linux disks instantly. Run winver to see your Home windows model. I am on 22000.282 as of the time of this writing.

I may also run wsl –help and see the –mount directions. If you do not have them, you are not on the newest, or you may strive putting in/replace WSL from the Home windows Retailer. Putting in WSL from the Home windows Retailer will get you updates quicker.

--mount <Disk>
Attaches and mounts a bodily disk in all WSL2 distributions.
Choices:
--bare
Connect the disk to WSL2, however do not mount it.

--type <Sort>
Filesystem to make use of when mounting a disk, if not specified defaults to ext4.

--options <Choices>
Further mount choices.

--partition <Index>
Index of the partition to mount, if not specified defaults to the entire disk.

--unmount [Disk]
Unmounts and detaches a disk from all WSL2 distributions.
Unmounts and detaches all disks if known as with out argument.

You may should be an admin to mount a disk. You may first get a listing of all of the disks utilizing this PowerShell question:

GET-CimInstance -query "SELECT * from Win32_DiskDrive"

The DeviceID is a path like .SOMETHING and that is what issues.

Then you definitely simply wsl --mount .SOMETHING".

The system will seem beneath /mnt/wsl/SOMETHING in your Linux occasion. You may mount unpartitioned disks like this, otherwise you can mount partitioned disks. Then you may run lsblk and see the partitions and so they’ll be beneath /dev/<System><Partition>. As soon as you recognize the partition quantity you may return and wsl --mount --.SOMETHING --partition --type Filesystem. The filesystem parameter is for issues like vfat, and so forth for filesystems which have kernel assist.

WSL --mount for ext4 and Linux File Systems on WSL2

At present SD Playing cards and Flash Drives aren’t working, however USB externals work and inner drives work, in addition to VHDs.


Sponsor: Couchbase Capella DBaaS is versatile, full-featured and absolutely managed  with built-in entry by way of Ok/V, SQL and full textual content search. It’s blazing quick, but surprisingly inexpensive. Attempt Capella at present without cost.




About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, guide, father, diabetic, and Microsoft worker. He’s a failed stand-up comedian, a cornrower, and a e book creator.

facebook
twitter
subscribe
About   Publication

Internet hosting By
Hosted in an Azure App Service










RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments