unique disk and partition identifiers please
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 33.7k
- Forks
- 1.8k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 116
Description
Is your feature request related to a problem? Please describe.
AFAIK There is a chance that the drive numbering changes between boots. The current --mount uses \.\PHYSICALDRIVE[X] ( --partition [Y] )to identify a drive (partition). But the PHYSICALDRIVE can change between boots and this make scripting more involved.
Describe the solution you'd like
Make a mount option that can use some form of disk identifier - a serialnumber, UUID or Label.
Something like:
wsl --mount --UUID a8feece7-338d-4efa-b90b-5de44564cb0d --type ext4
wsl --mount --UUID 432d7059-2211-4c37-ad13-a24ff60d38ff --type ext4
Maybe that is allready a routine task for the advanced windows user, but I need some help figureing out how to script adding the right partitions to WSL.
I do:
wsl --mount \\.\PHYSICALDRIVE8 --partition 1 --type ext
wsl --mount \\.\PHYSICALDRIVE9 --partition 1 --type ext
and so far, they keep their numbering between boots - but is that guaranteed ?
Here's what I have in Ubuntu Linux
jpn@pc01:~$ sudo lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 363.1M 1 disk
sdb 8:16 0 8G 0 disk [SWAP]
sdc 8:32 0 1T 0 disk /var/lib/docker
/mnt/wslg/distro
/
sdd 8:48 0 7.3T 0 disk
└─sdd1 8:49 0 7.3T 0 part /mnt/wsl/PHYSICALDRIVE8p1
sde 8:64 0 7.3T 0 disk
└─sde1 8:65 0 7.3T 0 part
jpn@pc01:~$ sudo blkid /dev/sdd
/dev/sdd: PTUUID="e44f910e-5225-0841-bb2b-156c3c0f796b" PTTYPE="gpt"
jpn@pc01:~$ sudo blkid /dev/sdd1
/dev/sdd1: LABEL="ZCT1HV6A" UUID="a8feece7-338d-4efa-b90b-5de44564cb0d" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="eb686024-df27-443c-9d6c-e2faf47cf523"
jpn@pc01:~$
jpn@pc01:~$
jpn@pc01:~$ sudo blkid /dev/sde
/dev/sde: PTUUID="41e34ee0-52e7-43e9-800a-0b97ebcf759c" PTTYPE="gpt"
jpn@pc01:~$ sudo blkid /dev/sde1
/dev/sde1: LABEL="ZCT31MZ2" UUID="432d7059-2211-4c37-ad13-a24ff60d38ff" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="43cc75e2-75a3-439b-a2b8-1623230aefa6"
and I can use the UUID's in my fstab (see man page)
and the UUID can be changed using tune2fs (see man page)
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.
Research direction
Start from the wsl --mount command and the current PHYSICALDRIVE and --partition arguments described in the issue. Compare the available disk identifiers—UUID, PARTUUID, serial number, and label—using the shown blkid and fstab examples, then define and implement stable identifier-based selection while preserving filesystem type and partition support. Done means the same disk or partition can be mounted reliably after drive numbering changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux
- Domain
- cli, operating-systems
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100