This assumes you can find and follow other directions elsewhere.
github is silly w/ not allowing /
in filenames, so i used \
.
-
install gentoo on wsl2 and make sure your starting openrc at wsl boot
-
follow https://medium.com/@stefan.berkner/automatically-starting-an-external-encrypted-ssd-in-windows-subsystem-wsl-6403c34e9680 to get your disk setup. if you follow that, it's encrypting an entire drive, but you can do partitions or whatever disk setup you want for your linux setup. the key thing is that you need to pass the entire drive (
--bare
) to let linux have its way with the drive. (also, you can't just mount a single partition of a drive due to a current limitation per wsl docs.)tip: use the following command in windows instead of the Powershell command they use in step 1
C:> wmic diskdrive list brief
-
IMPORTANT: STOP following the directions when your disk(s) are prepared and you're ready to copychange the simple mounting script that they suggest. we are doing something cleaner.
-
update
/etc/fstab
so that your partitions can be easily mounted. always set thenoauto
mount option on ALL encrypted partitions. read the comments in the example/etc/fstab
file below. the example file shows both an encrypted (/home
) and unencrypted (/scratch
) mount. -
test your mounts manually to make sure they work as you expect
-
edit
/etc/conf.d/dmcrypt
to decrypt any encrypted partitions. i've included the continuing example of/home
. again read the comments. -
rc-update add dmcrypt boot
-
download and copychange the
/etc/init.d/wslmount
init script. again, read the comments there. -
rc-update add wslmount boot
- microsoft/WSL#11078 when starting up, wsl gives you the prompt before all the openrc scripts finishes. so, give it a few seconds/minutes before hammering away.