[Feature] Adding --name parameter to wsl --mount
@OneBlue is already working on this.
Since Feb 2, 2021.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
As by the docs: https://docs.microsoft.com/en-us/windows/wsl/wsl2-mount-disk
$disk = "\\.\PhysicalDrive$((Mount-VHD -Path D:\data_disk.vhdx -PassThru | Get-Disk).Number)"
# assuming \\.\PhysicalDrive5
wsl --mount $disk -p 1
This will mount a VHD to /mnt/wsl/PhysicalDrive5p1
The problem is, if, at some point, other hard drives get attached to (or removed from) windows, /mnt/wsl/PhysicalDrive5p1 becomes no longer a reliable fixed mount point in WSL.
Use-case: Setting up WSL to use PhysicalDrive5p1 as the home-folder of the Linux user
Create a folder /mnt/wsl/PhysicalDrive5p1/<username>
ln -s /mnt/wsl/PhysicalDrive5p1/<username> /home/<username>
Problem: After attaching/detaching other hard drives PhysicalDrive5p1 becomes PhysicalDrive6p1 or PhysicalDrive4p1 which breaks the existing symlink.
Solution
wsl --mount $disk -p 1 --name dataDisk
ln -s /mnt/wsl/dataDisk/<username> /home/<username>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.